//-----------------------------------------------------------------------------
// Name: AnimateObject.cpp
// Auth: Dante Ratto, Rob Darty, Paul Godfrey
// Desc: AnimateObjects class
//-----------------------------------------------------------------------------

#include "SharedConstants.h"
#include "AnimateObject.h"
#include "Assert.h"

#include <windows.h>
#include "corona/corona.h"
#include <GL/glut.h>
#include <math.h>
#include <cstdlib>  // For srand() and rand()
#include "Bounding.h"
#include "InanimateObject.h"
#include "InanimateObjectManager.h"
#include "AnimateObject.h"
#include "AnimateObjectManager.h"
#include "DeadHuman.h"

#include <iostream>
using namespace std;

//-----------------------------------------------------------------------------
// Globals:
//-----------------------------------------------------------------------------
cAnimateObject gAnimateObject;

//Useful Health values for animates
const int kHumanHealth = 100;
const int kCowHealth = 200;
const float kHumanSpeed = 0.19f;
const float kZombieSpeed = 0.2f;
const float kCowSpeed = 0.09f;
const float kCowZombieSpeed = 0.1f;
const float kBossSpeed = 0.2f;

//-----------------------------------------------------------------------------
// Functions:
//-----------------------------------------------------------------------------
cAnimateObject* GetAnimateObject()
{
	return &gAnimateObject;
}

//-----------------------------------------------------------------------------
// class cAnimateObject:
//-----------------------------------------------------------------------------
cAnimateObject::cAnimateObject()
{
	mHealth = 1;
	mDamage = 0;
	mStatus = 0;
	mSpeed = 0;
	mYaw = 0;
	mPitch = 0;
	mOffsetX = 0;
	mOffsetZ = 0;
	mPosition[0] = 0;
	mPosition[1] = 0;
	mPosition[2] = 0;
	mColor[0] = 0;
	mColor[1] = 0;
	mColor[2] = 0;
	mColor[3] = 0;
	mColor[4] = 0;
	mColor[5] = 0;
	mRandom[0] = 0;
	mRandom[1] = 0;
	mRandom[2] = 0;
	mDirection[0] = 0;
	mDirection[1] = 0;
	mDirection[2] = 0;
	mUp=1;
	mFirst = true;
	mRotate = 0.0f;
	mDead = false;
	mBossHead1Status=true;
	mBossHead2Status=true;
	mBossHead3Status=true;
	mBossHead4Status=true;
	mBossHead5Status=true;
	mBossHead6Status=true;
	mBossHead7Status=true;
	mBossHead8Status=true;
//	eObjectType eType = kHuman;
}


//Destructor
cAnimateObject::~cAnimateObject()
{
}

//Set status of a particular head (which will affect draw code)
void cAnimateObject::SetBossHeadStatus(int h)
{
	if(h==0)
	{
		mBossHead1Status=false;
	}
	else if(h==1)
	{
		mBossHead2Status=false;
	}
	else if(h==2)
	{
		mBossHead3Status=false;
	}
	else if(h==3)
	{
		mBossHead4Status=false;
	}
	else if(h==4)
	{
		mBossHead5Status=false;
	}
	else if(h==5)
	{
		mBossHead6Status=false;
	}
	else if(h==6)
	{
		mBossHead7Status=false;
	}
	else if(h==7)
	{
		mBossHead8Status=false;
	}
}

//Sets the type of the object, then Sets variables
//Based on that type
void cAnimateObject::SetType(eObjectType eType)
{
	mType = eType;

	switch (mType)
	{
	case kPlayer:
		{
			SetSpeed(kHumanSpeed);
			SetHealth(kHumanHealth);
			SetStatus(1);
		break;
		}

	case kHuman:
		{
			SetColor(kColorHuman);
			SetSpeed(kHumanSpeed);
			SetHealth(kHumanHealth);
			SetStatus(1);

		break;
		}

		case kHumanVaccinated:
		{
			SetColor(kColorHumanVaccinated);
			SetSpeed(kHumanSpeed);
			SetHealth(kHumanHealth);
			SetStatus(1);
		break;
		}

		case kZombie:
		{
			SetColor(kColorZombie);
			SetSpeed(kZombieSpeed);
			SetHealth(kHumanHealth);
			SetStatus(1);		
		break;
		}

	case kCow:
		{
			SetColor(kColorCow);
			SetSpeed(kCowSpeed);
			SetHealth(kCowHealth);
			SetStatus(0);
		break;
		}

	case kCowVaccinated:
		{
			SetColor(kColorCowVaccinated);
			SetSpeed(kCowSpeed);
			SetHealth(kCowHealth);
			SetStatus(1);
		break;
		}

	case kCowZombie:
		{
			SetColor(kColorZombie);
			SetSpeed(kCowZombieSpeed);
			SetHealth(kCowHealth);
			SetStatus(2);
		break;
		}
	case kBoss:
		{
			SetSpeed(kBossSpeed);
			SetStatus(2);
		break;
		}
	}
}

//Gets object type
enum eObjectType cAnimateObject::GetType()
{
	return mType;
}

//Draws object based on type
void cAnimateObject::Draw(eObjectType eType)
{
	switch (eType)
	{
	case kHuman:
		{
			DrawHuman();
			
		break;
		}

	case kHumanVaccinated:
		{
			DrawHuman();
		
		break;
		}

	case kZombie:
		{
			DrawHuman();
		
		break;
		}

	case kCow:
		{
			DrawCow();
		
		break;
		}

	case kCowVaccinated:
		{
			DrawCow();
		
		break;
		}

	case kCowZombie:
		{
			DrawCow();
		
		break;
		}

	case kBoss:
		{
			DrawBoss();
			break;
		}
	}
}

//Increased object by position (mostly depricated)
void cAnimateObject::Move(tVector3f& position)
{
	mPosition[0] += position[0];
	mPosition[1] += position[1];
	mPosition[2] += position[2];
}

//Varient on above - allows individual input
void cAnimateObject::Move(float positionX, float positionY, float positionZ)
{
	mPosition[0] += positionX;
	mPosition[1] += positionY;
	mPosition[2] += positionZ;
}

//Old attack function - totally depricated
void cAnimateObject::Attack(int gunType)
{
	if(gunType != 6) //shotgun = 6
	{
		//cBullet->Fire(0);
	}

	else
	{
		//cBullet->Fire(0);
		//cBullet->Fire(1);
		//cBullet->Fire(2);
		//cBullet->Fire(3);
		//cBullet->Fire(4);
		//cBullet->Fire(5);
	}
}

//Infect - also depricated
void cAnimateObject::Infect()
{
	if(mStatus = 0)
	{
		SetStatus(2);
	}
}

//Kill object - depricated
void cAnimateObject::Die( float elapsedTimes )
{
	if(mHealth <= 0)
	{

		//cAnimateObjectManager* pAnimateObjectManager = GetAnimateObjectManager();
		//pAnimateObjectManger->AddAnimateObject( kDeadHuman );
		//death animation
	}
}

//Sets dead status
void cAnimateObject::SetDead( bool bValue )
{
	mDead = bValue;
}

// Gets dead status
bool cAnimateObject::GetDead()
{
	return mDead;
}

//Updated health of object
void cAnimateObject::UpdateHealth(int health)
{
	mHealth += health;
}		

//Gets health of object
int cAnimateObject::GetHealth()
{
	return mHealth;
}

//Sets health of object (used for init health)
void cAnimateObject::SetHealth(int health)
{
	mHealth = health;
}

//Gets speed of objcet
float cAnimateObject::GetSpeed()
{
	return mSpeed;
}

//Sets speed of object
void cAnimateObject::SetSpeed(float speed)
{
	mSpeed = speed;
}

//Gets Damage rating of object (depricated)
int cAnimateObject::GetDamage()
{
	return mDamage;
}

//Sets damage rating of an object (depricated)
void cAnimateObject::SetDamage(int damage)
{
	mDamage = damage;
}

//Gets yaw of object
float cAnimateObject::GetYaw()
{
	return mYaw;
}

//Sets yaw of object
void cAnimateObject::SetYaw(float angle)
{
	mYaw = angle;
}

//Gets pitch of object (unnecessary - no flying objects)
float cAnimateObject::GetPitch()
{
	return mPitch;
}

//Sets pitch (see above)
void cAnimateObject::SetPitch(float angle)
{
	mPitch = angle;
}

//Gets status of object
int cAnimateObject::GetStatus()
{
	return mStatus;
}

//0 = Normal, 1 = Vaccinated, 2 = Zombie (depricated)
void cAnimateObject::SetStatus(int status)
{
	mStatus = status;
}

//Gets X Position of object
float cAnimateObject::GetPositionX()
{
	return mPosition[0];
}

//Gets Y Position of object
float cAnimateObject::GetPositionY()
{
	return mPosition[1];
}

//Gets Z Position of object
float cAnimateObject::GetPositionZ()
{
	return mPosition[2];
}

//Sets object position
void cAnimateObject::SetPosition(tVector3f& position)
{
	mPosition[0] = position[0];
	mPosition[1] = position[1];
	mPosition[2] = position[2];
}

//As above
void cAnimateObject::SetPosition(float positionX, float positionY, float positionZ)
{
	mPosition[0] = positionX;
	mPosition[1] = positionY;
	mPosition[2] = positionZ;
}


//Sets object color
void cAnimateObject::SetColor(const tVector3f& color)
{
	mColor[0] = color[0];
	mColor[1] = color[1];
	mColor[2] = color[2];
}

//As above
void cAnimateObject::SetColor(const tVector6f& color)
{
	mColor[0] = color[0];
	mColor[1] = color[1];
	mColor[2] = color[2];
	mColor[3] = color[3];
	mColor[4] = color[4];
	mColor[5] = color[5];
}

//Gets calculated Random X
float cAnimateObject::GetRandomX()
{
	return mRandom[0];
}

//Gets calculated Random Y
float cAnimateObject::GetRandomY()
{
	return mRandom[1];
}

//Get calculated Random Z
float cAnimateObject::GetRandomZ()
{
	return mRandom[2];
}

//Sets offset x for positioning in buckets
void cAnimateObject::SetOffsetX(float offset)
{
	mOffsetX = offset;
}

//Sets offset z for positioning in buckets
void cAnimateObject::SetOffsetZ(float offset)
{
	mOffsetZ = offset;
}

//Gets offsetx
float cAnimateObject::GetOffsetX()
{
	return mOffsetX;
}

//Gets offsetz
float cAnimateObject::GetOffsetZ()
{
	return mOffsetZ;
}

//Sets Random positionX
void cAnimateObject::SetRandomX(float max, float offsetX)
{
	float normalizedRandom = (float)rand() / (float)RAND_MAX;
	mRandom[0] = (normalizedRandom * (2 * max) - max) + offsetX;
}

//Sets Random PositionY
void cAnimateObject::SetRandomY(float offsetY)
{
	float normalizedRandom = (float)rand() / (float)RAND_MAX;
	
	mRandom[1] = (normalizedRandom * (2 * kMaxRandom) - kMaxRandom) + offsetY;
}

//sets Random PositionZ
void cAnimateObject::SetRandomZ(float max, float offsetZ)
{
	float normalizedRandom = (float)rand() / (float)RAND_MAX;
	mRandom[2] = (normalizedRandom * (2 * max) - max) + offsetZ;
}


//Update the AnimateObject's position
void cAnimateObject::Update(float elapsedTimeS)
{	
		if(mDirection[0]>0.0f || mDirection[2]>0.0f ||mDirection[0]<0.0f||mDirection[2]<0.0f)
		{
			SetYaw((atan2(mDirection[0],mDirection[2]))/kDegreesToRadians);
			float xFDirection = sin((mYaw)*kDegreesToRadians);
			float zFDirection = cos((mYaw)*kDegreesToRadians);
			if(mType!=kBoss)
			{
				if(mUp==1 && mPosition[1]<0.2f)
				{
					mPosition[1]+=0.02f;
					if(mPosition[1]>=0.2f)
					{
						mUp=0;
					}
				}
				else if (mUp==0 && mPosition[1]>0.0f)
				{
					mPosition[1]-=0.02f;
					if(mPosition[1]<=0.0f)
					{
						mUp=1;
					}
				}
			}

			cInanimateObjectManager* pInanimateObjectManager = GetInanimateObjectManager();

			list<cInanimateObject>* liInanimate = pInanimateObjectManager->GetInanimateList();
			list<cInanimateObject>::iterator itIAO;

			if(!liInanimate->empty())
			{
				
				itIAO = liInanimate->begin();

				bool Contact = false;
				//Checks against inanimate objects for collisions
				for(itIAO; itIAO!=liInanimate->end();)
				{
					cBounding *aBounding = (&*itIAO)->GetBounding();

					float minX = aBounding->getMinX();
					float maxX = aBounding->getMaxX();
					float minZ = aBounding->getMinZ();
					float maxZ = aBounding->getMaxZ();

						
					float inanimateX = itIAO->GetPositionX();
					float inanimateZ = itIAO->GetPositionZ();

					float vectorX = inanimateX - mPosition[0];
					float vectorZ = inanimateZ - mPosition[2];

					float vLen = sqrt((vectorX*vectorX)+(vectorZ*vectorZ));

					float percentage = mMaster.GetSphereRadius()/vLen;

					float testX = vectorX*percentage;
	
					float testZ = vectorZ*percentage;
			
					float x = mPosition[0]-testX;
					float z = mPosition[2]-testZ;

					if((((x>minX)&&(x<maxX))||((x>maxX)&&(x<minX)))&&(((z>minZ)&&(z<maxZ))||((z>maxZ)&&(z<minZ))))
					{
						Contact = true;
					}

					

					//If contact - bounce off in minus direction
					if(Contact)
					{
						float a = maxX-mPosition[0];
						float b = mPosition[0]-minX;
						float c = maxZ-mPosition[2];
						float d = mPosition[2]-minZ;

						if(a<0)
						{
							a*=-1;
						}
						if(b<0)
						{
							b*=-1;
						}
						if(c<0)
						{
							c*=-1;
						}
						if(d<0)
						{
							d*=-1;
						}


						if(a<b)
						{
							if(c<d)
							{
								if(a<c)
								{
									mPosition[0] = maxX+2.0f;
									Contact=false;
								}
								else
								{
									mPosition[2] = maxZ+2.0f;
									Contact=false;
								}
							}
							else
							{
								if(a<d)
								{
									mPosition[0] = maxX+2.0f;
									Contact=false;
								}
								else
								{
									mPosition[2] = minZ-2.0f;
									Contact = false;
								}

							}
						}
						else
						{
							if(c<d)
							{
								if(b<c)
								{
									mPosition[0] = minX-2.0f;
									Contact=false;
								}
								else
								{
									mPosition[2] = maxZ+2.0f;
									Contact=false;
								}
							}
							else
							{
								if(b<d)
								{
									mPosition[0] = minX-2.0f;
									Contact=false;
								}
								else
								{
									mPosition[2] = minZ-2.0f;
									Contact=false;
								}

							}
						}
					}
					else
					{
						//If no contact with inanimate - move 
						mPosition[0] += ((mSpeed * elapsedTimeS) * xFDirection);
						mPosition[2] += ((mSpeed * elapsedTimeS) * zFDirection);
					}

					if(itIAO!=liInanimate->end())
					{
						itIAO++;
					}
				}
			}
		
			else
			{
				//If no inanimates - move
				mPosition[0] += ((mSpeed * elapsedTimeS) * xFDirection);
				mPosition[2] += ((mSpeed * elapsedTimeS) * zFDirection);
			}

		//	mPosition[0] += ((mSpeed * elapsedTimeS) * xFDirection);
		//	mPosition[2] += ((mSpeed * elapsedTimeS) * zFDirection);
		
		
		

		
		}

}

//Rotate animate
void cAnimateObject::Rotate( float r )
{
	mRotate = r;
}


//Draw Boss (taking into account head status)
void cAnimateObject::DrawBoss()
{
	glColor3f(0.0f, 0.6f, 0.0f);

	glPushMatrix();
	glTranslatef( mPosition[0], 1.7f, mPosition[2] );
	glRotatef(mYaw-90, 0.0f, 1.0f, 0.0f);
	glBegin( GL_QUAD_STRIP );

		glVertex3f( 0.0f, 1.7f, 2.3f );
		glVertex3f( 0.0f, 0.0f, 1.7f );
		glVertex3f( 0.0f, 2.0f, 2.3f );
		glVertex3f( 0.0f, 0.4f, 1.7f );

		glVertex3f( -0.3f, 2.0f, 2.3f );
		glVertex3f( -0.3f, 0.4f, 1.7f );

		glVertex3f( -0.3f, 1.7f, 2.3f );
		glVertex3f( -0.3f, 0.0f, 1.7f );
		
		glVertex3f( 0.0f, 1.7f, 2.3f );
		glVertex3f( 0.0f, 0.0f, 1.7f );

		//glVertex3f( 0.0f, 0.0f, 1.7f );

	glEnd();

	glBegin( GL_QUAD_STRIP );

		glVertex3f( 0.0f, -1.7f, 3.0f );
		glVertex3f( 0.0f, 1.7f, 2.3f );
		glVertex3f( 0.0f, -1.7f, 3.2f );
		glVertex3f( 0.0f, 2.0f, 2.3f );

		glVertex3f( -0.3f, -1.7f, 3.0f );
		glVertex3f( -0.3f, 2.0f, 2.3f );

		glVertex3f( -0.3f, -1.7f, 3.0f );
		glVertex3f( -0.3f, 1.7f, 2.3f );

		glVertex3f( 0.0f, -1.7f, 3.0f );
		glVertex3f( 0.0f, 1.7f, 2.3f );


	glEnd();



	glPushMatrix();

	glRotatef( -45.0f, 0, 1.0f, 0 );

	glBegin( GL_QUAD_STRIP );

		glVertex3f( 0.0f, 1.7f, 2.3f );
		glVertex3f( 0.0f, 0.0f, 1.7f );
		glVertex3f( 0.0f, 2.0f, 2.3f );
		glVertex3f( 0.0f, 0.4f, 1.7f );

		glVertex3f( -0.3f, 2.0f, 2.3f );
		glVertex3f( -0.3f, 0.4f, 1.7f );

		glVertex3f( -0.3f, 1.7f, 2.3f );
		glVertex3f( -0.3f, 0.0f, 1.7f );
		
		glVertex3f( 0.0f, 1.7f, 2.3f );
		glVertex3f( 0.0f, 0.0f, 1.7f );

		//glVertex3f( 0.0f, 0.0f, 1.7f );

	glEnd();

	glBegin( GL_QUAD_STRIP );

		glVertex3f( 0.0f, -1.7f, 3.0f );
		glVertex3f( 0.0f, 1.7f, 2.3f );
		glVertex3f( 0.0f, -1.7f, 3.2f );
		glVertex3f( 0.0f, 2.0f, 2.3f );

		glVertex3f( -0.3f, -1.7f, 3.0f );
		glVertex3f( -0.3f, 2.0f, 2.3f );

		glVertex3f( -0.3f, -1.7f, 3.0f );
		glVertex3f( -0.3f, 1.7f, 2.3f );

		glVertex3f( 0.0f, -1.7f, 3.0f );
		glVertex3f( 0.0f, 1.7f, 2.3f );


	glEnd();

	glPopMatrix();


	glPushMatrix();

	glRotatef( 45.0f, 0, 1.0f, 0 );

	glBegin( GL_QUAD_STRIP );

		glVertex3f( 0.0f, 1.7f, 2.3f );
		glVertex3f( 0.0f, 0.0f, 1.7f );
		glVertex3f( 0.0f, 2.0f, 2.3f );
		glVertex3f( 0.0f, 0.4f, 1.7f );

		glVertex3f( -0.3f, 2.0f, 2.3f );
		glVertex3f( -0.3f, 0.4f, 1.7f );

		glVertex3f( -0.3f, 1.7f, 2.3f );
		glVertex3f( -0.3f, 0.0f, 1.7f );
		
		glVertex3f( 0.0f, 1.7f, 2.3f );
		glVertex3f( 0.0f, 0.0f, 1.7f );

		//glVertex3f( 0.0f, 0.0f, 1.7f );

	glEnd();

	glBegin( GL_QUAD_STRIP );

		glVertex3f( 0.0f, -1.7f, 3.0f );
		glVertex3f( 0.0f, 1.7f, 2.3f );
		glVertex3f( 0.0f, -1.7f, 3.2f );
		glVertex3f( 0.0f, 2.0f, 2.3f );

		glVertex3f( -0.3f, -1.7f, 3.0f );
		glVertex3f( -0.3f, 2.0f, 2.3f );

		glVertex3f( -0.3f, -1.7f, 3.0f );
		glVertex3f( -0.3f, 1.7f, 2.3f );

		glVertex3f( 0.0f, -1.7f, 3.0f );
		glVertex3f( 0.0f, 1.7f, 2.3f );


	glEnd();

	glPopMatrix();

	glPushMatrix();

	glRotatef( -225.0f, 0, 1.0f, 0 );

	glBegin( GL_QUAD_STRIP );

		glVertex3f( 0.0f, 1.7f, 2.3f );
		glVertex3f( 0.0f, 0.0f, 1.7f );
		glVertex3f( 0.0f, 2.0f, 2.3f );
		glVertex3f( 0.0f, 0.4f, 1.7f );

		glVertex3f( -0.3f, 2.0f, 2.3f );
		glVertex3f( -0.3f, 0.4f, 1.7f );

		glVertex3f( -0.3f, 1.7f, 2.3f );
		glVertex3f( -0.3f, 0.0f, 1.7f );
		
		glVertex3f( 0.0f, 1.7f, 2.3f );
		glVertex3f( 0.0f, 0.0f, 1.7f );

		//glVertex3f( 0.0f, 0.0f, 1.7f );

	glEnd();

	glBegin( GL_QUAD_STRIP );

		glVertex3f( 0.0f, -1.7f, 3.0f );
		glVertex3f( 0.0f, 1.7f, 2.3f );
		glVertex3f( 0.0f, -1.7f, 3.2f );
		glVertex3f( 0.0f, 2.0f, 2.3f );

		glVertex3f( -0.3f, -1.7f, 3.0f );
		glVertex3f( -0.3f, 2.0f, 2.3f );

		glVertex3f( -0.3f, -1.7f, 3.0f );
		glVertex3f( -0.3f, 1.7f, 2.3f );

		glVertex3f( 0.0f, -1.7f, 3.0f );
		glVertex3f( 0.0f, 1.7f, 2.3f );


	glEnd();

	glPopMatrix();

	glPushMatrix();

	glRotatef( 180.0f, 0, 1.0f, 0 );

	glBegin( GL_QUAD_STRIP );

		glVertex3f( 0.0f, 1.7f, 2.3f );
		glVertex3f( 0.0f, 0.0f, 1.7f );
		glVertex3f( 0.0f, 2.0f, 2.3f );
		glVertex3f( 0.0f, 0.4f, 1.7f );

		glVertex3f( -0.3f, 2.0f, 2.3f );
		glVertex3f( -0.3f, 0.4f, 1.7f );

		glVertex3f( -0.3f, 1.7f, 2.3f );
		glVertex3f( -0.3f, 0.0f, 1.7f );
		
		glVertex3f( 0.0f, 1.7f, 2.3f );
		glVertex3f( 0.0f, 0.0f, 1.7f );

		//glVertex3f( 0.0f, 0.0f, 1.7f );

	glEnd();

	glBegin( GL_QUAD_STRIP );

		glVertex3f( 0.0f, -1.7f, 3.0f );
		glVertex3f( 0.0f, 1.7f, 2.3f );
		glVertex3f( 0.0f, -1.7f, 3.2f );
		glVertex3f( 0.0f, 2.0f, 2.3f );

		glVertex3f( -0.3f, -1.7f, 3.0f );
		glVertex3f( -0.3f, 2.0f, 2.3f );

		glVertex3f( -0.3f, -1.7f, 3.0f );
		glVertex3f( -0.3f, 1.7f, 2.3f );

		glVertex3f( 0.0f, -1.7f, 3.0f );
		glVertex3f( 0.0f, 1.7f, 2.3f );


	glEnd();

	glPopMatrix();

	glPushMatrix();

	glRotatef( 225.0f, 0, 1.0f, 0 );

	glBegin( GL_QUAD_STRIP );

		glVertex3f( 0.0f, 1.7f, 2.3f );
		glVertex3f( 0.0f, 0.0f, 1.7f );
		glVertex3f( 0.0f, 2.0f, 2.3f );
		glVertex3f( 0.0f, 0.4f, 1.7f );

		glVertex3f( -0.3f, 2.0f, 2.3f );
		glVertex3f( -0.3f, 0.4f, 1.7f );

		glVertex3f( -0.3f, 1.7f, 2.3f );
		glVertex3f( -0.3f, 0.0f, 1.7f );
		
		glVertex3f( 0.0f, 1.7f, 2.3f );
		glVertex3f( 0.0f, 0.0f, 1.7f );

		//glVertex3f( 0.0f, 0.0f, 1.7f );

	glEnd();

	glBegin( GL_QUAD_STRIP );

		glVertex3f( 0.0f, -1.7f, 3.0f );
		glVertex3f( 0.0f, 1.7f, 2.3f );
		glVertex3f( 0.0f, -1.7f, 3.2f );
		glVertex3f( 0.0f, 2.0f, 2.3f );

		glVertex3f( -0.3f, -1.7f, 3.0f );
		glVertex3f( -0.3f, 2.0f, 2.3f );

		glVertex3f( -0.3f, -1.7f, 3.0f );
		glVertex3f( -0.3f, 1.7f, 2.3f );

		glVertex3f( 0.0f, -1.7f, 3.0f );
		glVertex3f( 0.0f, 1.7f, 2.3f );


	glEnd();

	glPopMatrix();


	glColor3f( 0.0f, 0.0f, 0.0f );

	glutSolidSphere( 1.7f, 10, 10 );
	float h1alpha = 1.0f;
	float h2alpha = 1.0f;
	float h3alpha = 1.0f;
	float h4alpha = 1.0f;
	float h5alpha = 1.0f;
	float h6alpha = 1.0f;
	float h7alpha = 1.0f;
	float h8alpha = 1.0f;

	int headcount=0;

	//head 1
	if(mBossHead1Status)
	{
		glPushMatrix();
			glTranslatef( 0, 2.00f, 0.0f );

			glColor4f( 0.0f, 0.6f, 0.0f, 1.0f);
			glutSolidSphere( 0.2f, 10, 10 );
			
			//eyes...
			glPushMatrix();
				glTranslatef( 0.18f, 0.0f, 0.05f );
				glColor4f( 1.0f, 0.0f, 0.0f, 1.0f );
				glutSolidSphere( 0.035, 5, 5 );
			glPopMatrix();
			glPushMatrix();
				glTranslatef( 0.18f, 0.0f, -0.05f );
				glutSolidSphere( 0.035f, 5, 5 );
			glPopMatrix();

			//nose
			glColor4f(0.0f, 0.6f, 0.0f, 1.0f);
			glPushMatrix();
				glTranslatef(0.2f, -0.05f, 0);
				glutSolidSphere(0.035 , 5, 5);
			glPopMatrix();

		glPopMatrix();
	}
	else
	{
		headcount++;
	}

	//neck 1
	GLUquadricObj *pObj;

	pObj = gluNewQuadric();
	gluQuadricNormals(pObj, GLU_SMOOTH);

	glPushMatrix();
		//glColor3f(0.08f, 0.08f, 0.08f);

		glTranslatef(0.0f, 1.9f, 0.0f);

		glRotatef(90.0f, 1.0f, 0.0f, 0.0f);

		gluCylinder(pObj, 0.15f, 0.2f, 0.4f, 4, 4);

	glPopMatrix();



	//head 2
	if(mBossHead2Status)
	{
		glPushMatrix();
			glTranslatef( 0, 1.94f, 0.5f );

			glColor4f( 0.0f, 0.6f, 0.0f, 1.0f );
			glutSolidSphere( 0.2f, 10, 10 );
			
			//eyes...
			glPushMatrix();
				glTranslatef( 0.18f, 0.0f, 0.05f );
				glColor4f( 1.0f, 0.0f, 0.0f, 1.0f );
				glutSolidSphere( 0.035, 5, 5 );
			glPopMatrix();
			glPushMatrix();
				glTranslatef( 0.18f, 0.0f, -0.05f );
				glutSolidSphere( 0.035f, 5, 5 );
			glPopMatrix();

			//nose
			glColor4f(0.0f, 0.6f, 0.0f, 1.0f);
			glPushMatrix();
				glTranslatef(0.2f, -0.05f, 0);
				glutSolidSphere(0.035 , 5, 5);
			glPopMatrix();


		glPopMatrix();
	}
	else
	{
		headcount++;
	}
	//neck 2
	//GLUquadricObj *pObj;

//	pObj = gluNewQuadric();
	//gluQuadricNormals(pObj, GLU_SMOOTH);

	glPushMatrix();
		//glColor3f(0.08f, 0.08f, 0.08f);

		glTranslatef(0.0f, 1.84f, 0.5f);

		glRotatef(90.0f, 1.0f, 0.0f, 0.0f);

		gluCylinder(pObj, 0.15f, 0.2f, 0.4f, 4, 4);

	glPopMatrix();


	//head 3
	if(mBossHead3Status)
	{
		glPushMatrix();
			glTranslatef( 0, 1.94f, -0.5f );

			glColor4f( 0.0f, 0.6f, 0.0f, 1.0f );
			glutSolidSphere( 0.2f, 10, 10 );
			
			//eyes...
			glPushMatrix();
				glTranslatef( 0.18f, 0.0f, 0.05f );
				glColor4f( 1.0f, 0.0f, 0.0f, 1.0f );
				glutSolidSphere( 0.035, 5, 5 );
			glPopMatrix();
			glPushMatrix();
				glTranslatef( 0.18f, 0.0f, -0.05f );
				glutSolidSphere( 0.035f, 5, 5 );
			glPopMatrix();

			//nose
			glColor4f(0.0f, 0.6f, 0.0f, 1.0f);
			glPushMatrix();
				glTranslatef(0.2f, -0.05f, 0);
				glutSolidSphere(0.035 , 5, 5);
			glPopMatrix();

		glPopMatrix();
	}
	else
	{
		headcount++;
	}

	//neck 3
	glPushMatrix();
		//glColor3f(0.08f, 0.08f, 0.08f);

		glTranslatef(0.0f, 1.84f, -0.5f);

		glRotatef(90.0f, 1.0f, 0.0f, 0.0f);

		gluCylinder(pObj, 0.15f, 0.2f, 0.4f, 4, 4);

	glPopMatrix();



	//head 4
	if(mBossHead4Status)
	{
		glPushMatrix();
			glTranslatef( 0, 1.73f, 1.0f );

			glColor4f( 0.0f, 0.6f, 0.0f, 1.0f );
			glutSolidSphere( 0.2f, 10, 10 );
			
			//eyes...
			glPushMatrix();
				glTranslatef( 0.18f, 0.0f, 0.05f );
				glColor4f( 1.0f, 0.0f, 0.0f, 1.0f );
				glutSolidSphere( 0.035, 5, 5 );
			glPopMatrix();
			glPushMatrix();
				glTranslatef( 0.18f, 0.0f, -0.05f );
				glutSolidSphere( 0.035f, 5, 5 );
			glPopMatrix();

			//nose
			glColor4f(0.0f, 0.6f, 0.0f, 1.0f);
			glPushMatrix();
				glTranslatef(0.2f, -0.05f, 0);
				glutSolidSphere(0.035 , 5, 5);
			glPopMatrix();

		glPopMatrix();
	}
	else
	{
		headcount++;
	}

	//neck 4
	glPushMatrix();
		//glColor3f(0.08f, 0.08f, 0.08f);

		glTranslatef(0.0f, 1.58f, 1.0f);

		glRotatef(90.0f, 1.0f, 0.0f, 0.0f);

		gluCylinder(pObj, 0.15f, 0.2f, 0.5f, 4, 4);

	glPopMatrix();

	//head 5
	if(mBossHead5Status)
	{
		glPushMatrix();
			glTranslatef( 0, 1.73f, -1.0f );

			glColor4f( 0.0f, 0.6f, 0.0f, 1.0f );
			glutSolidSphere( 0.2f, 10, 10 );
			
			//eyes...
			glPushMatrix();
				glTranslatef( 0.18f, 0.0f, 0.05f );
				glColor4f( 1.0f, 0.0f, 0.0f, 1.0f );
				glutSolidSphere( 0.035, 5, 5 );
			glPopMatrix();
			glPushMatrix();
				glTranslatef( 0.18f, 0.0f, -0.05f );
				glutSolidSphere( 0.035f, 5, 5 );
			glPopMatrix();

			//nose
			glColor4f(0.0f, 0.6f, 0.0f, 1.0f);
			glPushMatrix();
				glTranslatef(0.2f, -0.05f, 0);
				glutSolidSphere(0.035 , 5, 5);
			glPopMatrix();

		glPopMatrix();
	}
	else
	{
		headcount++;
	}

	//neck 5
	glPushMatrix();
		//glColor3f(0.08f, 0.08f, 0.08f);

		glTranslatef(0.0f, 1.58f, -1.0f);

		glRotatef(90.0f, 1.0f, 0.0f, 0.0f);

		gluCylinder(pObj, 0.15f, 0.2f, 0.5f, 4, 4);

	glPopMatrix();


	//head 6
	if(mBossHead6Status)
	{
		glPushMatrix();
			glTranslatef( 1.25f, 1.56f, 0.0f );

			glColor4f( 0.0f, 0.6f, 0.0f, 1.0f );
			glutSolidSphere( 0.2f, 10, 10 );
			
			//eyes...
			glPushMatrix();
				glTranslatef( 0.18f, 0.0f, 0.05f );
				glColor4f(1.0f, 0.0f, 0.0f, 1.0f );
				glutSolidSphere( 0.035, 5, 5 );
			glPopMatrix();
			glPushMatrix();
				glTranslatef( 0.18f, 0.0f, -0.05f );
				glutSolidSphere( 0.035f, 5, 5 );
			glPopMatrix();

			//nose
			glColor4f(0.0f, 0.6f, 0.0f, 1.0f);
			glPushMatrix();
				glTranslatef(0.2f, -0.05f, 0);
				glutSolidSphere(0.035 , 5, 5);
			glPopMatrix();

		glPopMatrix();
	}
	else
	{
		headcount++;
	}

	//neck 6
	glPushMatrix();
		//glColor3f(0.08f, 0.08f, 0.08f);

		glTranslatef(1.25f, 1.46f, 0.0f);

		glRotatef(90.0f, 1.0f, 0.0f, 0.0f);

		gluCylinder(pObj, 0.15f, 0.2f, 0.7f, 4, 4);

	glPopMatrix();

	//head 7
	if(mBossHead7Status)
	{
		glPushMatrix();
			glTranslatef( 0.85f, 1.72f, 0.5f );

			glColor4f( 0.0f, 0.6f, 0.0f, 1.0f );
			glutSolidSphere( 0.2f, 10, 10 );
			
			//eyes...
			glPushMatrix();
				glTranslatef( 0.18f, 0.0f, 0.05f );
				glColor4f( 1.0f, 0.0f, 0.0f, 1.0f );
				glutSolidSphere( 0.035, 5, 5 );
			glPopMatrix();
			glPushMatrix();
				glTranslatef( 0.18f, 0.0f, -0.05f );
				glutSolidSphere( 0.035f, 5, 5 );
			glPopMatrix();

			//nose
			glColor4f(0.0f, 0.6f, 0.0f, 1.0f);
			glPushMatrix();
				glTranslatef(0.2f, -0.05f, 0);
				glutSolidSphere(0.035 , 5, 5);
			glPopMatrix();

		glPopMatrix();
	}
	else
	{
		headcount++;
	}

	//neck 7
	glPushMatrix();
		//glColor3f(0.08f, 0.08f, 0.08f);

		glTranslatef(0.850f, 1.62f, 0.5f);

		glRotatef(90.0f, 1.0f, 0.0f, 0.0f);

		gluCylinder(pObj, 0.15f, 0.2f, 0.5f, 4, 4);

	glPopMatrix();


	//head 8
	if(mBossHead8Status)
	{
		glPushMatrix();
			glTranslatef( 0.85f, 1.72f, -0.5f );

			glColor4f( 0.0f, 0.6f, 0.0f, 1.0f );
			glutSolidSphere( 0.2f, 10, 10 );
			
			//eyes...
			glPushMatrix();
				glTranslatef( 0.18f, 0.0f, 0.05f );
				glColor4f( 1.0f, 0.0f, 0.0f, 1.0f );
				glutSolidSphere( 0.035, 5, 5 );
			glPopMatrix();
			glPushMatrix();
				glTranslatef( 0.18f, 0.0f, -0.05f );
				glutSolidSphere( 0.035f, 5, 5 );
			glPopMatrix();

			//nose
			glColor4f(0.0f, 0.6f, 0.0f, 1.0f);
			glPushMatrix();
				glTranslatef(0.2f, -0.05f, 0);
				glutSolidSphere(0.035 , 5, 5);
			glPopMatrix();

		glPopMatrix();
	}
	else
	{
		headcount++;
	}

	//neck 8
	glPushMatrix();
		//glColor3f(0.08f, 0.08f, 0.08f);

		glTranslatef(0.85f, 1.62f, -0.5f);

		glRotatef(90.0f, 1.0f, 0.0f, 0.0f);

		gluCylinder(pObj, 0.15f, 0.2f, 0.5f, 4, 4);

	glPopMatrix();

	glPopMatrix();

	//IF all heads are gone - winner!
	if(headcount==8)
	{
		mVictoryStatus=true;
	}
	if(mFirst)
	{
		//Adds all heads as bounding bodies
		AddBody(mPosition[0], mPosition[1]+2.0f+1.7f, mPosition[2], 0.3f);
		AddBody(mPosition[0], mPosition[1]+1.94f+1.7f, mPosition[2]+0.5f, 0.3f);
		AddBody(mPosition[0], mPosition[1]+1.94f+1.7f, mPosition[2]-0.5f, 0.3f);
		AddBody(mPosition[0], mPosition[1]+1.73f+1.7f, mPosition[2]+1.0f, 0.3f);
		AddBody(mPosition[0], mPosition[1]+1.73f+1.7f, mPosition[2]-1.0f, 0.3f);
		AddBody(mPosition[0]+1.25f, mPosition[1]+1.56f+1.7f, mPosition[2], 0.3f);
		AddBody(mPosition[0]+0.85f, mPosition[1]+1.72f+1.7f, mPosition[2]+0.5f, 0.3f);
		AddBody(mPosition[0]+0.85f, mPosition[1]+1.72f+1.7f, mPosition[2]-0.5f, 0.3f);

		mMaster.SetSphere(mPosition[0], mPosition[1]+0.75f, mPosition[2], 3.25f, kSphereBody);
		mFirst=false;
	}
	else
	{
		//Updates head positions
		UpdateHeads(mPosition[0], mPosition[1]+2.0f+1.7f, mPosition[2], 0.2f, 0, mYaw, mPosition[0], mPosition[2]);
		UpdateHeads(mPosition[0], mPosition[1]+1.94f+1.7f, mPosition[2]+0.5f, 0.2f, 1, mYaw, mPosition[0], mPosition[2]);
		UpdateHeads(mPosition[0], mPosition[1]+1.94f+1.7f, mPosition[2]-0.5f, 0.2f, 2, mYaw, mPosition[0], mPosition[2]);
		UpdateHeads(mPosition[0], mPosition[1]+1.73f+1.7f, mPosition[2]+1.0f, 0.2f, 3, mYaw, mPosition[0], mPosition[2]);
		UpdateHeads(mPosition[0], mPosition[1]+1.73f+1.7f, mPosition[2]-1.0f, 0.2f, 4, mYaw, mPosition[0], mPosition[2]);
		UpdateHeads(mPosition[0]+1.25f, mPosition[1]+1.56f+1.7f, mPosition[2], 0.2f, 5, mYaw, mPosition[0], mPosition[2]);
		UpdateHeads(mPosition[0]+0.85f, mPosition[1]+1.72f+1.7f, mPosition[2]+0.5f, 0.3f, 6, mYaw, mPosition[0], mPosition[2]);
		
		UpdateHeads(mPosition[0]+0.85f, mPosition[1]+1.72f+1.7f, mPosition[2]-0.5f, 0.3f, 7, mYaw, mPosition[0], mPosition[2]);
		mMaster.SetSphere(mPosition[0], mPosition[1]+0.75f, mPosition[2], 3.25f, kSphereBody);
	}

}


//Sets victory status
bool cAnimateObject::GetVictoryStatus()
{
	return mVictoryStatus;
}

//Updates position of a particular head
void cAnimateObject::UpdateHeads(float x, float y, float z, float r, int pos, float yaw, float bX, float bZ)
{
	float dist = sqrt(((bX-x)*(bX-x))+((bZ-z)*(bZ-z)));
	float addangle = (atan2(bX-x,bZ-z))/kDegreesToRadians;

	float xPos = cos((yaw+addangle)*-1*kDegreesToRadians)*dist;
	float zPos = sin((yaw+addangle)*-1*kDegreesToRadians)*dist;

	mBody[pos].SetSphere(bX+xPos,y,bZ+zPos,r, kSphereBody);
}

//Draws a human (color depends on human/zombie)
void cAnimateObject::DrawHuman()
{
	glColor3f(mColor[0], mColor[1], mColor[2]);
			//glDisable(GL_CULL_FACE);
			
			glPushMatrix();
			{

					glRotatef( mRotate, 1.0f, 0.0f, 0.0f );

				//glPushMatrix();
					glTranslatef(mPosition[0], mPosition[1], mPosition[2]);
					glRotatef( mYaw-90, 0.0f, 1.0f, 0.0f );
					glBegin(GL_QUADS);

					glColor3f(0.01f, 0.01f, 0.01f);
					glVertex3f(0.3f, mPosition[1]-(2*mPosition[1])+0.02f, -0.3f);
					glVertex3f(-0.3f, mPosition[1]-(2*mPosition[1])+0.02f, -0.3f);
					glVertex3f(-0.3f, mPosition[1]-(2*mPosition[1])+0.02f, 0.3f);
					glVertex3f(0.3f, mPosition[1]-(2*mPosition[1])+0.02f, 0.3f);
					
					
					


					glColor3f( 0.6f, 0.3f, 0.3f );

					//left foot
					//front
					glNormal3f(1.0f,0.0f,0.0f);
					glVertex3f( 0.2f, 0, 0 );
					glVertex3f( 0.2f, 0.15f, 0 );
					glVertex3f( 0.2f, 0.15f, 0.2f );
					glVertex3f( 0.2f, 0, 0.2f );

					//left-side
					glNormal3f(0.0f,0.0f,1.0f);
					glVertex3f( 0.2f, 0, 0.2f );
					glVertex3f( 0.2f, 0.15f, 0.2f );
					glVertex3f( -0.1f, 0.15f, 0.2f );
					glVertex3f( -0.1f, 0, 0.2f );
					
					//right side
					glNormal3f(0.0f,0.0f,-1.0f);
					glVertex3f( 0.2f, 0, 0 );
					glVertex3f( -0.1f, 0, 0 );
					glVertex3f( -0.1f, 0.15f, 0 );
					glVertex3f( 0.2f, 0.15f, 0 );
					
					//top
					glNormal3f(0.0f,1.0f,0.0f);
					glVertex3f( 0.2f, 0.15f, 0.2f );
					glVertex3f( 0.2f, 0.15f, 0 );
					glVertex3f( -0.1f, 0.15f, 0 );
					glVertex3f( -0.1f, 0.15f, 0.2f );

					//back
					glNormal3f(-1.0f,0.0f,0.0f);
					glVertex3f( -0.1f, 0, 0 );
					glVertex3f( -0.1f, 0, 0.2f );
					glVertex3f( -0.1f, 0.15f, 0.2f );
					glVertex3f( -0.1f, 0.15f, 0 );

					//right foot
					//front
					glNormal3f(1.0f,0.0f,0.0f);
					glVertex3f( 0.2f, 0, 0 );
					glVertex3f( 0.2f, 0, -0.2f );
					glVertex3f( 0.2f, 0.15f, -0.2f );
					glVertex3f( 0.2f, 0.15f, 0 );

					//left side
					glNormal3f(0.0f,0.0f,1.0f);
					glVertex3f( 0.2f, 0, 0 );
					glVertex3f( 0.2f, 0.15f, 0 );
					glVertex3f( -0.1f, 0.15f, 0 );
					glVertex3f( -0.1f, 0, 0 );

					//right side
					glNormal3f(0.0f,0.0f,-1.0f);
					glVertex3f( 0.2f, 0, -0.2f );
					glVertex3f( -0.1f, 0, -0.2f );
					glVertex3f( -0.1f, 0.15f, -0.2f );
					glVertex3f( 0.2f, 0.15f, -0.2f );

					//top
					glNormal3f(0.0f,1.0f,0.0f);
					glVertex3f( 0.2f, 0.15f, -0.2f );
					glVertex3f( -0.1f, 0.15f, -0.2f );
					glVertex3f( -0.1f, 0.15f, 0 );
					glVertex3f( 0.2f, 0.15f, 0 );

					//back
					glNormal3f(-1.0f,0.0f,0.0f);
					glVertex3f( -0.1f, 0, 0 );
					glVertex3f( -0.1f, 0.15f, 0 );
					glVertex3f( -0.1f, 0.15f, -0.2f );
					glVertex3f( -0.1f, 0, -0.2f );

					glColor3f(mColor[0], mColor[1], mColor[2]);

					//neck
					//left side
					glNormal3f(0.0f,0.0f,1.0f);
					glVertex3f( 0.1f, 1.5f, 0.1f );
					glVertex3f( 0.1f, 1.65f, 0.1f );
					glVertex3f( -0.1f, 1.65f, 0.1f );
					glVertex3f( -0.1f, 1.5f, 0.1f );

					//front
					glNormal3f(1.0f,0.0f,0.0f);
					glVertex3f( 0.1f, 1.5f, -0.1f );
					glVertex3f( 0.1f, 1.65f, -0.1f );
					glVertex3f( 0.1f, 1.65f, 0.1f );
					glVertex3f( 0.1f, 1.5f, 0.1f );

					//right side
					glNormal3f(0.0f,0.0f,1.0f);
					glVertex3f( 0.1f, 1.5f, -0.1f );
					glVertex3f( -0.1f, 1.5f, -0.1f );
					glVertex3f( -0.1f, 1.65f, -0.1f );
					glVertex3f( 0.1f, 1.65f, -0.1f );

					//back
					glNormal3f(-1.0f,0.0f,0.0f);
					glVertex3f( -0.1f, 1.5f, -0.1f );
					glVertex3f( -0.1f, 1.5f, 0.1f );
					glVertex3f( -0.1f, 1.65f, 0.1f );
					glVertex3f( -0.1f, 1.65f, -0.1f );

					glColor3fv(kColorBlack);

					//body
					//left
					glNormal3f(0.0f,0.0f,1.0f);
					glVertex3f( 0.2f, 1.0f, 0.2f );
					glVertex3f( 0.2f, 1.5f, 0.2f );
					glVertex3f( -0.2f, 1.5f, 0.2f );
					glVertex3f( -0.2f, 1.0f, 0.2f );

					//front
					glNormal3f(1.0f,0.0f,0.0f);
					glVertex3f( 0.2f, 1.0f, -0.2f );
					glVertex3f( 0.2f, 1.5f, -0.2f );
					glVertex3f( 0.2f, 1.5f, 0.2f );
					glVertex3f( 0.2f, 1.0f, 0.2f );

					//right
					glNormal3f(0.0f,0.0f,-1.0f);
					glVertex3f( 0.2f, 1.0f, -0.2f );
					glVertex3f( -0.2f, 1.0f, -0.2f );
					glVertex3f( -0.2f, 1.5f, -0.2f );
					glVertex3f( 0.2f, 1.5f, -0.2f );

					//back
					glNormal3f(-1.0f,0.0f,0.0f);
					glVertex3f( -0.2f, 1.0f, -0.2f );
					glVertex3f( -0.2f, 1.0f, 0.2f );
					glVertex3f( -0.2f, 1.5f, 0.2f );
					glVertex3f( -0.2f, 1.5f, -0.2f );

					//top
					glNormal3f(0.0f, 1.0f,0.0f);
					glVertex3f( 0.2f, 1.5f, 0.2f );
					glVertex3f( 0.2f, 1.5f, -0.2f );
					glVertex3f( -0.2f, 1.5f, -0.2f );
					glVertex3f( -0.2f, 1.5f, 0.2f );

					//left arm
					//left side
					glNormal3f(0.0f,0.0f,1.0f);
					glVertex3f( 0.1f, 1.0f, 0.3f );
					glVertex3f( 0.1f, 1.5f, 0.3f );
					glVertex3f( -0.1f, 1.5f, 0.3f );
					glVertex3f( -0.1f, 1.0f, 0.3f );

					//right side
					glNormal3f(0.0f,0.0f,-1.0f);
					glVertex3f( 0.1f, 1.0f, 0.2f );
					glVertex3f( -0.1f, 1.0f, 0.2f );
					glVertex3f( -0.1f, 1.5f, 0.2f );
					glVertex3f( 0.1f, 1.5f, 0.2f );

					//front
					glNormal3f(1.0f,0.0f,0.0f);
					glVertex3f( 0.1f, 1.0f, 0.2f );
					glVertex3f( 0.1f, 1.5f, 0.2f );
					glVertex3f( 0.1f, 1.5f, 0.3f );
					glVertex3f( 0.1f, 1.0f, 0.3f );

					//back
					glNormal3f(-1.0f,0.0f,0.0f);
					glVertex3f( -0.1f, 1.0f, 0.2f );
					glVertex3f( -0.1f, 1.0f, 0.3f );
					glVertex3f( -0.1f, 1.5f, 0.3f );
					glVertex3f( -0.1f, 1.5f, 0.2f );

					//top
					glNormal3f(0.0f, 1.0f, 0.0f);
					glVertex3f( -0.1f, 1.5f, 0.3f );
					glVertex3f( 0.1f, 1.5f, 0.3f );
					glVertex3f( 0.1f, 1.5f, 0.2f );
					glVertex3f( -0.1f, 1.5f, 0.2f );

					//right arm
					//right side
					glNormal3f(0.0f,0.0f,-1.0f);
					glVertex3f( 0.1f, 1.0f, -0.3f );
					glVertex3f( -0.1f, 1.0f, -0.3f );
					glVertex3f( -0.1f, 1.5f, -0.3f );
					glVertex3f( 0.1f, 1.5f, -0.3f );

					//left side
					glNormal3f(0.0f,0.0f,-1.0f);
					glVertex3f( 0.1f, 1.0f, -0.2f );
					glVertex3f( 0.1f, 1.5f, -0.2f );
					glVertex3f( -0.1f, 1.5f, -0.2f );
					glVertex3f( -0.1f, 1.0f, -0.2f );

					//front
					glNormal3f(1.0f,0.0f,0.0f);
					glVertex3f( 0.1f, 1.0f, -0.3f );
					glVertex3f( 0.1f, 1.5f, -0.3f );
					glVertex3f( 0.1f, 1.5f, -0.2f );
					glVertex3f( 0.1f, 1.0f, -0.2f );

					//back
					glNormal3f(-1.0f,0.0f,0.0f);
					glVertex3f( -0.1f, 1.0f, -0.3f );
					glVertex3f( -0.1f, 1.0f, -0.2f );
					glVertex3f( -0.1f, 1.5f, -0.2f );
					glVertex3f( -0.1f, 1.5f, -0.3f );

					//top
					glNormal3f(0.0f,1.0f,0.0f);
					glVertex3f( 0.1f, 1.5f, -0.2f );
					glVertex3f( 0.1f, 1.5f, -0.3f );
					glVertex3f( -0.1f, 1.5f, -0.3f );
					glVertex3f( -0.1f, 1.5f, -0.2f );

					glColor3f(0.3f, 0.3f, 1.0f);

					//hips
					//front
					glNormal3f(1.0f,0.0f,0.0f);
					glVertex3f( 0.2f, 0.8f, -0.2f );
					glVertex3f( 0.2f, 1.0f, -0.2f );
					glVertex3f( 0.2f, 1.0f, 0.2f );
					glVertex3f( 0.2f, 0.8f, 0.2f );

					//left
					glNormal3f(0.0f,0.0f,1.0f);
					glVertex3f( 0.2f, 0.8f, 0.2f );
					glVertex3f( 0.2f, 1.0f, 0.2f );
					glVertex3f( -0.2f, 1.0f, 0.2f );
					glVertex3f( -0.2f, 0.8f, 0.2f );

					//back
					glNormal3f(-1.0f,0.0f,0.0f);
					glVertex3f( -0.2f, 0.8f, -0.2f );
					glVertex3f( -0.2f, 0.8f, 0.2f );
					glVertex3f( -0.2f, 1.0f, 0.2f );
					glVertex3f( -0.2f, 1.0f, -0.2f );

					//right
					glNormal3f(0.0f,0.0f,-1.0f);
					glVertex3f( 0.2f, 0.8f, -0.2f );
					glVertex3f( -0.2f, 0.8f, -0.2f );
					glVertex3f( -0.2f, 1.0f, -0.2f );
					glVertex3f( 0.2f, 1.0f, -0.2f );


					//legs 
					//left leg
					//front
					glNormal3f(0.974391f, 0.22486f, 0.0f);
					glVertex3f( 0.05f, 0.15f, 0 );
					glVertex3f( 0.2f, 0.8f, 0 );
					glVertex3f( 0.2f, 0.8f, 0.2f );
					glVertex3f( 0.05f, 0.15f, 0.2f );

					//left
					glNormal3f(0.0f,0.0f,1.0f);
					glVertex3f( 0.05f, 0.15f, 0.2f );
					glVertex3f( 0.2f, 0.8f, 0.2f );
					glVertex3f( -0.2f, 0.8f, 0.2f );
					glVertex3f( -0.1f, 0.15f, 0.2f );

					//right
					glNormal3f(0.0f,0.0f,-1.0f);
					glVertex3f( 0.05f, 0.15f, 0 );
					glVertex3f( -0.1f, 0.15f, 0 );
					glVertex3f( -0.2f, 0.8f, 0 );
					glVertex3f( 0.2f, 0.8f, 0 );

					//back
					glNormal3f(-0.988372f,-0.152057f,0.0f);
					glVertex3f( -0.1f, 0.15f, 0 );
					glVertex3f( -0.1f, 0.15f, 0.2f );
					glVertex3f( -0.2f, 0.8f, 0.2f );
					glVertex3f( -0.2f, 0.8f, 0 );

					//right leg
					//front
					glNormal3f(0.974391f, -0.22486f, 0.0f);
					glVertex3f( 0.05f, 0.15f, 0 );
					glVertex3f( 0.05f, 0.15f, -0.2f );
					glVertex3f( 0.2f, 0.8f, -0.2f );
					glVertex3f( 0.2f, 0.8f, 0 );

					//back
					glNormal3f(-0.988372f,-0.152057f,0.0f);
					glVertex3f( -0.1f, 0.15f, 0 );
					glVertex3f( -0.2f, 0.8f, 0 );
					glVertex3f( -0.2f, 0.8f, -0.2f );
					glVertex3f( -0.1f, 0.15f, -0.2f );

					//right
					glNormal3f(0.0f,0.0f,-1.0f);
					glVertex3f( 0.05f, 0.15f, -0.2f );
					glVertex3f( -0.1f, 0.15f, -0.2f );
					glVertex3f( -0.2f, 0.8f, -0.2f );
					glVertex3f( 0.2f, 0.8f, -0.2f );

					//left
					glNormal3f(0.0f,0.0f,1.0f);
					glVertex3f( 0.05f, 0.15f, 0 );
					glVertex3f( 0.2f, 0.8f, 0 );
					glVertex3f( -0.2f, 0.8f, 0 );
					glVertex3f( -0.1f, 0.15f, 0 );

					glColor3f(mColor[0], mColor[1], mColor[2]);

					//left hand
					//front
					glNormal3f(1.0f,0.0f,0.0f);
					glVertex3f( 0.1f, 0.8f, 0.2f );
					glVertex3f( 0.1f, 1.0f, 0.2f );
					glVertex3f( 0.1f, 1.0f, 0.3f );
					glVertex3f( 0.1f, 0.8f, 0.3f );

					//left side
					glNormal3f(0.0f,0.0f,1.0f);
					glVertex3f( 0.1f, 0.8f, 0.3f );
					glVertex3f( 0.1f, 1.0f, 0.3f );
					glVertex3f( -0.1f, 1.0f, 0.3f );
					glVertex3f( -0.1f, 0.8f, 0.3f );

					//right side
					glNormal3f(0.0f,0.0f,1.0f);
					glVertex3f( 0.1f, 0.8f, 0.2f );
					glVertex3f( 0.1f, 1.0f, 0.2f );
					glVertex3f( -0.1f, 1.0f, 0.2f );
					glVertex3f( -0.1f, 0.8f, 0.2f );

					//back
					glNormal3f(-1.0f,0.0f,0.0f);
					glVertex3f( -0.1f, 0.8f, 0.2f );
					glVertex3f( -0.1f, 0.8f, 0.3f );
					glVertex3f( -0.1f, 1.0f, 0.3f );
					glVertex3f( -0.1f, 1.0f, 0.2f );

					//bottom
					glNormal3f(0.0f,-1.0f,0.0f);
					glVertex3f( 0.1f, 0.8f, 0.3f );
					glVertex3f( -0.1f, 0.8f, 0.3f );
					glVertex3f( -0.1f, 0.8f, 0.2f );
					glVertex3f( 0.1f, 0.8f, 0.2f );

					//right hand
					//front
					glNormal3f(1.0f,0.0f,0.0f);
					glVertex3f( 0.1f, 0.8f, -0.3f );
					glVertex3f( 0.1f, 1.0f, -0.3f );
					glVertex3f( 0.1f, 1.0f, -0.2f );
					glVertex3f( 0.1f, 0.8f, -0.2f );

					//back
					glNormal3f(-1.0f,0.0f,0.0f);
					glVertex3f( -0.1f, 0.8f, -0.3f );
					glVertex3f( -0.1f, 0.8f, -0.2f );
					glVertex3f( -0.1f, 1.0f, -0.2f );
					glVertex3f( -0.1f, 1.0f, -0.3f );

					//left side
					glNormal3f(0.0f,0.0f,1.0f);
					glVertex3f( 0.1f, 0.8f, -0.2f );
					glVertex3f( 0.1f, 1.0f, -0.2f );
					glVertex3f( -0.1f, 1.0f, -0.2f );
					glVertex3f( -0.1f, 0.8f, -0.2f );

					//right side
					glNormal3f(0.0f,0.0f,-1.0f);
					glVertex3f( 0.1f, 0.8f, -0.3f );
					glVertex3f( -0.1f, 0.8f, -0.3f );
					glVertex3f( -0.1f, 1.0f, -0.3f );
					glVertex3f( 0.1f, 1.0f, -0.3f );

					//bottom
					glNormal3f(0.0f,-1.0f,0.0f);
					glVertex3f( 0.1f, 0.8f, -0.2f );
					glVertex3f( -0.1f, 0.8f, -0.2f );
					glVertex3f( -0.1f, 0.8f, -0.3f );
					glVertex3f( 0.1f, 0.8f, -0.3f );

					glEnd();

					//head
					glPushMatrix();

					glTranslatef( 0, 1.8f, 0 );
					glutSolidSphere( 0.2f, 10, 10 );
					glPopMatrix();

					//eyes
					glColor3f(mColor[3], mColor[4], mColor[5]);
					glPushMatrix();
					glTranslatef (0.18f, 1.85f, 0.05f);
					glutSolidSphere(0.035 , 5, 5);
					glPopMatrix();

					glPushMatrix();
					glTranslatef (0.18f, 1.85f, -0.05f);
					glutSolidSphere(0.035 , 5, 5);
					glPopMatrix();

					//nose
					glColor3f(mColor[0], mColor[1], mColor[2]);
					glPushMatrix();
					glTranslatef(0.2f, 1.8f, 0);
					glutSolidSphere(0.035 , 5, 5);
					glPopMatrix();

					glColor3f(0.95f, 1.0f, 0.95f);
					glPushMatrix();
					glTranslatef(0.2f, 1.8f, 0);
					//glutWireSphere( 0.035, 5, 5 );
					//glPopMatrix();
				glPopMatrix();
				}
				glPopMatrix();

				mHeadBounding.SetSphere(mPosition[0], mPosition[1]+1.8f, mPosition[2], 0.25f, kSphereHead);
				if(mFirst)
				{
					//Set bounding stuff
					AddBody(mPosition[0], mPosition[1]+0.25f, mPosition[2], 0.3f);
					AddBody(mPosition[0], mPosition[1]+0.75f, mPosition[2], 0.3f);
					AddBody(mPosition[0], mPosition[1]+1.25f, mPosition[2], 0.3f);
					mMaster.SetSphere(mPosition[0], mPosition[1]+1.0f, mPosition[2], 1.0f, kSphereBody);
					mFirst=false;
				}
				else
				{
					//Update boundings
					UpdateBody(mPosition[0], mPosition[1]+0.25f, mPosition[2], 0.3f, 0);
					UpdateBody(mPosition[0], mPosition[1]+0.75f, mPosition[2], 0.3f, 1);
					UpdateBody(mPosition[0], mPosition[1]+1.25f, mPosition[2], 0.3f, 2);
					mMaster.SetSphere(mPosition[0], mPosition[1]+1.0f, mPosition[2], 1.0f, kSphereBody);
				}


}

//Add bounding to body vector
void cAnimateObject::AddBody(float x, float y, float z, float r)
{
	cBounding* newBounding = GetBounding();
	newBounding->SetSphere(x,y,z,r,kSphereBody);
	mBody.push_back(*newBounding);
}

//Update bodies
void cAnimateObject::UpdateBody(float x, float y, float z, float r, int pos)
{
	mBody[pos].SetSphere(x,y,z,r, kSphereBody);
}


//Draws a dead human
void cAnimateObject::DrawDeadHuman()
{
	glColor3f(mColor[0], mColor[1], mColor[2]);
			//glDisable(GL_CULL_FACE);
			
			glPushMatrix();
			{
					if ( mHealth <= 0 )
					{
						mRotate = -90.0f;


					}

					glRotatef( mRotate, 1.0f, 0.0f, 0.0f );

				//glPushMatrix();
					glTranslatef(mPosition[0], mPosition[1], mPosition[2]);
					glRotatef( mYaw-90, 0.0f, 1.0f, 0.0f );
					glBegin(GL_QUADS);

					glColor3f(0.01f, 0.01f, 0.01f);
					glVertex3f(0.3f, mPosition[1]-(2*mPosition[1])+0.02f, -0.3f);
					glVertex3f(-0.3f, mPosition[1]-(2*mPosition[1])+0.02f, -0.3f);
					glVertex3f(-0.3f, mPosition[1]-(2*mPosition[1])+0.02f, 0.3f);
					glVertex3f(0.3f, mPosition[1]-(2*mPosition[1])+0.02f, 0.3f);
					
					
					


					glColor3f( 0.6f, 0.3f, 0.3f );

					//left foot
					//front
					glNormal3f(1.0f,0.0f,0.0f);
					glVertex3f( 0.2f, 0, 0 );
					glVertex3f( 0.2f, 0.15f, 0 );
					glVertex3f( 0.2f, 0.15f, 0.2f );
					glVertex3f( 0.2f, 0, 0.2f );

					//left-side
					glNormal3f(0.0f,0.0f,1.0f);
					glVertex3f( 0.2f, 0, 0.2f );
					glVertex3f( 0.2f, 0.15f, 0.2f );
					glVertex3f( -0.1f, 0.15f, 0.2f );
					glVertex3f( -0.1f, 0, 0.2f );
					
					//right side
					glNormal3f(0.0f,0.0f,-1.0f);
					glVertex3f( 0.2f, 0, 0 );
					glVertex3f( -0.1f, 0, 0 );
					glVertex3f( -0.1f, 0.15f, 0 );
					glVertex3f( 0.2f, 0.15f, 0 );
					
					//top
					glNormal3f(0.0f,1.0f,0.0f);
					glVertex3f( 0.2f, 0.15f, 0.2f );
					glVertex3f( 0.2f, 0.15f, 0 );
					glVertex3f( -0.1f, 0.15f, 0 );
					glVertex3f( -0.1f, 0.15f, 0.2f );

					//back
					glNormal3f(-1.0f,0.0f,0.0f);
					glVertex3f( -0.1f, 0, 0 );
					glVertex3f( -0.1f, 0, 0.2f );
					glVertex3f( -0.1f, 0.15f, 0.2f );
					glVertex3f( -0.1f, 0.15f, 0 );

					//right foot
					//front
					glNormal3f(1.0f,0.0f,0.0f);
					glVertex3f( 0.2f, 0, 0 );
					glVertex3f( 0.2f, 0, -0.2f );
					glVertex3f( 0.2f, 0.15f, -0.2f );
					glVertex3f( 0.2f, 0.15f, 0 );

					//left side
					glNormal3f(0.0f,0.0f,1.0f);
					glVertex3f( 0.2f, 0, 0 );
					glVertex3f( 0.2f, 0.15f, 0 );
					glVertex3f( -0.1f, 0.15f, 0 );
					glVertex3f( -0.1f, 0, 0 );

					//right side
					glNormal3f(0.0f,0.0f,-1.0f);
					glVertex3f( 0.2f, 0, -0.2f );
					glVertex3f( -0.1f, 0, -0.2f );
					glVertex3f( -0.1f, 0.15f, -0.2f );
					glVertex3f( 0.2f, 0.15f, -0.2f );

					//top
					glNormal3f(0.0f,1.0f,0.0f);
					glVertex3f( 0.2f, 0.15f, -0.2f );
					glVertex3f( -0.1f, 0.15f, -0.2f );
					glVertex3f( -0.1f, 0.15f, 0 );
					glVertex3f( 0.2f, 0.15f, 0 );

					//back
					glNormal3f(-1.0f,0.0f,0.0f);
					glVertex3f( -0.1f, 0, 0 );
					glVertex3f( -0.1f, 0.15f, 0 );
					glVertex3f( -0.1f, 0.15f, -0.2f );
					glVertex3f( -0.1f, 0, -0.2f );

					glColor3f(mColor[0], mColor[1], mColor[2]);

					//neck
					//left side
					glNormal3f(0.0f,0.0f,1.0f);
					glVertex3f( 0.1f, 1.5f, 0.1f );
					glVertex3f( 0.1f, 1.65f, 0.1f );
					glVertex3f( -0.1f, 1.65f, 0.1f );
					glVertex3f( -0.1f, 1.5f, 0.1f );

					//front
					glNormal3f(1.0f,0.0f,0.0f);
					glVertex3f( 0.1f, 1.5f, -0.1f );
					glVertex3f( 0.1f, 1.65f, -0.1f );
					glVertex3f( 0.1f, 1.65f, 0.1f );
					glVertex3f( 0.1f, 1.5f, 0.1f );

					//right side
					glNormal3f(0.0f,0.0f,1.0f);
					glVertex3f( 0.1f, 1.5f, -0.1f );
					glVertex3f( -0.1f, 1.5f, -0.1f );
					glVertex3f( -0.1f, 1.65f, -0.1f );
					glVertex3f( 0.1f, 1.65f, -0.1f );

					//back
					glNormal3f(-1.0f,0.0f,0.0f);
					glVertex3f( -0.1f, 1.5f, -0.1f );
					glVertex3f( -0.1f, 1.5f, 0.1f );
					glVertex3f( -0.1f, 1.65f, 0.1f );
					glVertex3f( -0.1f, 1.65f, -0.1f );

					glColor3fv(kColorBlack);

					//body
					//left
					glNormal3f(0.0f,0.0f,1.0f);
					glVertex3f( 0.2f, 1.0f, 0.2f );
					glVertex3f( 0.2f, 1.5f, 0.2f );
					glVertex3f( -0.2f, 1.5f, 0.2f );
					glVertex3f( -0.2f, 1.0f, 0.2f );

					//front
					glNormal3f(1.0f,0.0f,0.0f);
					glVertex3f( 0.2f, 1.0f, -0.2f );
					glVertex3f( 0.2f, 1.5f, -0.2f );
					glVertex3f( 0.2f, 1.5f, 0.2f );
					glVertex3f( 0.2f, 1.0f, 0.2f );

					//right
					glNormal3f(0.0f,0.0f,-1.0f);
					glVertex3f( 0.2f, 1.0f, -0.2f );
					glVertex3f( -0.2f, 1.0f, -0.2f );
					glVertex3f( -0.2f, 1.5f, -0.2f );
					glVertex3f( 0.2f, 1.5f, -0.2f );

					//back
					glNormal3f(-1.0f,0.0f,0.0f);
					glVertex3f( -0.2f, 1.0f, -0.2f );
					glVertex3f( -0.2f, 1.0f, 0.2f );
					glVertex3f( -0.2f, 1.5f, 0.2f );
					glVertex3f( -0.2f, 1.5f, -0.2f );

					//top
					glNormal3f(0.0f, 1.0f,0.0f);
					glVertex3f( 0.2f, 1.5f, 0.2f );
					glVertex3f( 0.2f, 1.5f, -0.2f );
					glVertex3f( -0.2f, 1.5f, -0.2f );
					glVertex3f( -0.2f, 1.5f, 0.2f );

					//left arm
					//left side
					glNormal3f(0.0f,0.0f,1.0f);
					glVertex3f( 0.1f, 1.0f, 0.3f );
					glVertex3f( 0.1f, 1.5f, 0.3f );
					glVertex3f( -0.1f, 1.5f, 0.3f );
					glVertex3f( -0.1f, 1.0f, 0.3f );

					//right side
					glNormal3f(0.0f,0.0f,-1.0f);
					glVertex3f( 0.1f, 1.0f, 0.2f );
					glVertex3f( -0.1f, 1.0f, 0.2f );
					glVertex3f( -0.1f, 1.5f, 0.2f );
					glVertex3f( 0.1f, 1.5f, 0.2f );

					//front
					glNormal3f(1.0f,0.0f,0.0f);
					glVertex3f( 0.1f, 1.0f, 0.2f );
					glVertex3f( 0.1f, 1.5f, 0.2f );
					glVertex3f( 0.1f, 1.5f, 0.3f );
					glVertex3f( 0.1f, 1.0f, 0.3f );

					//back
					glNormal3f(-1.0f,0.0f,0.0f);
					glVertex3f( -0.1f, 1.0f, 0.2f );
					glVertex3f( -0.1f, 1.0f, 0.3f );
					glVertex3f( -0.1f, 1.5f, 0.3f );
					glVertex3f( -0.1f, 1.5f, 0.2f );

					//top
					glNormal3f(0.0f, 1.0f, 0.0f);
					glVertex3f( -0.1f, 1.5f, 0.3f );
					glVertex3f( 0.1f, 1.5f, 0.3f );
					glVertex3f( 0.1f, 1.5f, 0.2f );
					glVertex3f( -0.1f, 1.5f, 0.2f );

					//right arm
					//right side
					glNormal3f(0.0f,0.0f,-1.0f);
					glVertex3f( 0.1f, 1.0f, -0.3f );
					glVertex3f( -0.1f, 1.0f, -0.3f );
					glVertex3f( -0.1f, 1.5f, -0.3f );
					glVertex3f( 0.1f, 1.5f, -0.3f );

					//left side
					glNormal3f(0.0f,0.0f,-1.0f);
					glVertex3f( 0.1f, 1.0f, -0.2f );
					glVertex3f( 0.1f, 1.5f, -0.2f );
					glVertex3f( -0.1f, 1.5f, -0.2f );
					glVertex3f( -0.1f, 1.0f, -0.2f );

					//front
					glNormal3f(1.0f,0.0f,0.0f);
					glVertex3f( 0.1f, 1.0f, -0.3f );
					glVertex3f( 0.1f, 1.5f, -0.3f );
					glVertex3f( 0.1f, 1.5f, -0.2f );
					glVertex3f( 0.1f, 1.0f, -0.2f );

					//back
					glNormal3f(-1.0f,0.0f,0.0f);
					glVertex3f( -0.1f, 1.0f, -0.3f );
					glVertex3f( -0.1f, 1.0f, -0.2f );
					glVertex3f( -0.1f, 1.5f, -0.2f );
					glVertex3f( -0.1f, 1.5f, -0.3f );

					//top
					glNormal3f(0.0f,1.0f,0.0f);
					glVertex3f( 0.1f, 1.5f, -0.2f );
					glVertex3f( 0.1f, 1.5f, -0.3f );
					glVertex3f( -0.1f, 1.5f, -0.3f );
					glVertex3f( -0.1f, 1.5f, -0.2f );

					glColor3f(0.3f, 0.3f, 1.0f);

					//hips
					//front
					glNormal3f(1.0f,0.0f,0.0f);
					glVertex3f( 0.2f, 0.8f, -0.2f );
					glVertex3f( 0.2f, 1.0f, -0.2f );
					glVertex3f( 0.2f, 1.0f, 0.2f );
					glVertex3f( 0.2f, 0.8f, 0.2f );

					//left
					glNormal3f(0.0f,0.0f,1.0f);
					glVertex3f( 0.2f, 0.8f, 0.2f );
					glVertex3f( 0.2f, 1.0f, 0.2f );
					glVertex3f( -0.2f, 1.0f, 0.2f );
					glVertex3f( -0.2f, 0.8f, 0.2f );

					//back
					glNormal3f(-1.0f,0.0f,0.0f);
					glVertex3f( -0.2f, 0.8f, -0.2f );
					glVertex3f( -0.2f, 0.8f, 0.2f );
					glVertex3f( -0.2f, 1.0f, 0.2f );
					glVertex3f( -0.2f, 1.0f, -0.2f );

					//right
					glNormal3f(0.0f,0.0f,-1.0f);
					glVertex3f( 0.2f, 0.8f, -0.2f );
					glVertex3f( -0.2f, 0.8f, -0.2f );
					glVertex3f( -0.2f, 1.0f, -0.2f );
					glVertex3f( 0.2f, 1.0f, -0.2f );


					//legs 
					//left leg
					//front
					glNormal3f(0.974391f, 0.22486f, 0.0f);
					glVertex3f( 0.05f, 0.15f, 0 );
					glVertex3f( 0.2f, 0.8f, 0 );
					glVertex3f( 0.2f, 0.8f, 0.2f );
					glVertex3f( 0.05f, 0.15f, 0.2f );

					//left
					glNormal3f(0.0f,0.0f,1.0f);
					glVertex3f( 0.05f, 0.15f, 0.2f );
					glVertex3f( 0.2f, 0.8f, 0.2f );
					glVertex3f( -0.2f, 0.8f, 0.2f );
					glVertex3f( -0.1f, 0.15f, 0.2f );

					//right
					glNormal3f(0.0f,0.0f,-1.0f);
					glVertex3f( 0.05f, 0.15f, 0 );
					glVertex3f( -0.1f, 0.15f, 0 );
					glVertex3f( -0.2f, 0.8f, 0 );
					glVertex3f( 0.2f, 0.8f, 0 );

					//back
					glNormal3f(-0.988372f,-0.152057f,0.0f);
					glVertex3f( -0.1f, 0.15f, 0 );
					glVertex3f( -0.1f, 0.15f, 0.2f );
					glVertex3f( -0.2f, 0.8f, 0.2f );
					glVertex3f( -0.2f, 0.8f, 0 );

					//right leg
					//front
					glNormal3f(0.974391f, -0.22486f, 0.0f);
					glVertex3f( 0.05f, 0.15f, 0 );
					glVertex3f( 0.05f, 0.15f, -0.2f );
					glVertex3f( 0.2f, 0.8f, -0.2f );
					glVertex3f( 0.2f, 0.8f, 0 );

					//back
					glNormal3f(-0.988372f,-0.152057f,0.0f);
					glVertex3f( -0.1f, 0.15f, 0 );
					glVertex3f( -0.2f, 0.8f, 0 );
					glVertex3f( -0.2f, 0.8f, -0.2f );
					glVertex3f( -0.1f, 0.15f, -0.2f );

					//right
					glNormal3f(0.0f,0.0f,-1.0f);
					glVertex3f( 0.05f, 0.15f, -0.2f );
					glVertex3f( -0.1f, 0.15f, -0.2f );
					glVertex3f( -0.2f, 0.8f, -0.2f );
					glVertex3f( 0.2f, 0.8f, -0.2f );

					//left
					glNormal3f(0.0f,0.0f,1.0f);
					glVertex3f( 0.05f, 0.15f, 0 );
					glVertex3f( 0.2f, 0.8f, 0 );
					glVertex3f( -0.2f, 0.8f, 0 );
					glVertex3f( -0.1f, 0.15f, 0 );

					glColor3f(mColor[0], mColor[1], mColor[2]);

					//left hand
					//front
					glNormal3f(1.0f,0.0f,0.0f);
					glVertex3f( 0.1f, 0.8f, 0.2f );
					glVertex3f( 0.1f, 1.0f, 0.2f );
					glVertex3f( 0.1f, 1.0f, 0.3f );
					glVertex3f( 0.1f, 0.8f, 0.3f );

					//left side
					glNormal3f(0.0f,0.0f,1.0f);
					glVertex3f( 0.1f, 0.8f, 0.3f );
					glVertex3f( 0.1f, 1.0f, 0.3f );
					glVertex3f( -0.1f, 1.0f, 0.3f );
					glVertex3f( -0.1f, 0.8f, 0.3f );

					//right side
					glNormal3f(0.0f,0.0f,1.0f);
					glVertex3f( 0.1f, 0.8f, 0.2f );
					glVertex3f( 0.1f, 1.0f, 0.2f );
					glVertex3f( -0.1f, 1.0f, 0.2f );
					glVertex3f( -0.1f, 0.8f, 0.2f );

					//back
					glNormal3f(-1.0f,0.0f,0.0f);
					glVertex3f( -0.1f, 0.8f, 0.2f );
					glVertex3f( -0.1f, 0.8f, 0.3f );
					glVertex3f( -0.1f, 1.0f, 0.3f );
					glVertex3f( -0.1f, 1.0f, 0.2f );

					//bottom
					glNormal3f(0.0f,-1.0f,0.0f);
					glVertex3f( 0.1f, 0.8f, 0.3f );
					glVertex3f( -0.1f, 0.8f, 0.3f );
					glVertex3f( -0.1f, 0.8f, 0.2f );
					glVertex3f( 0.1f, 0.8f, 0.2f );

					//right hand
					//front
					glNormal3f(1.0f,0.0f,0.0f);
					glVertex3f( 0.1f, 0.8f, -0.3f );
					glVertex3f( 0.1f, 1.0f, -0.3f );
					glVertex3f( 0.1f, 1.0f, -0.2f );
					glVertex3f( 0.1f, 0.8f, -0.2f );

					//back
					glNormal3f(-1.0f,0.0f,0.0f);
					glVertex3f( -0.1f, 0.8f, -0.3f );
					glVertex3f( -0.1f, 0.8f, -0.2f );
					glVertex3f( -0.1f, 1.0f, -0.2f );
					glVertex3f( -0.1f, 1.0f, -0.3f );

					//left side
					glNormal3f(0.0f,0.0f,1.0f);
					glVertex3f( 0.1f, 0.8f, -0.2f );
					glVertex3f( 0.1f, 1.0f, -0.2f );
					glVertex3f( -0.1f, 1.0f, -0.2f );
					glVertex3f( -0.1f, 0.8f, -0.2f );

					//right side
					glNormal3f(0.0f,0.0f,-1.0f);
					glVertex3f( 0.1f, 0.8f, -0.3f );
					glVertex3f( -0.1f, 0.8f, -0.3f );
					glVertex3f( -0.1f, 1.0f, -0.3f );
					glVertex3f( 0.1f, 1.0f, -0.3f );

					//bottom
					glNormal3f(0.0f,-1.0f,0.0f);
					glVertex3f( 0.1f, 0.8f, -0.2f );
					glVertex3f( -0.1f, 0.8f, -0.2f );
					glVertex3f( -0.1f, 0.8f, -0.3f );
					glVertex3f( 0.1f, 0.8f, -0.3f );

					glEnd();

					//head
					glPushMatrix();

					glTranslatef( 0, 1.8f, 0 );
					glutSolidSphere( 0.2f, 100, 100 );
					glPopMatrix();

					//eyes
					glColor3f(mColor[3], mColor[4], mColor[5]);
					glPushMatrix();
					glTranslatef (0.18f, 1.85f, 0.05f);
					glutSolidSphere(0.035 , 5, 5);
					glPopMatrix();

					glPushMatrix();
					glTranslatef (0.18f, 1.85f, -0.05f);
					glutSolidSphere(0.035 , 5, 5);
					glPopMatrix();

					//nose
					glColor3f(mColor[0], mColor[1], mColor[2]);
					glPushMatrix();
					glTranslatef(0.2f, 1.8f, 0);
					glutSolidSphere(0.035 , 5, 5);
					glPopMatrix();

					glColor3f(0.95f, 1.0f, 0.95f);
					glPushMatrix();
					glTranslatef(0.2f, 1.8f, 0);
					//glutWireSphere( 0.035, 5, 5 );
					//glPopMatrix();
				glPopMatrix();
				}
				glPopMatrix();

}

//Draws a very small cow!
void cAnimateObject::DrawCow()
{
	glColor3f(mColor[0], mColor[1], mColor[2]);
			//glDisable(GL_CULL_FACE);
			
			glPushMatrix();
			{
				glTranslatef(mPosition[0], mPosition[1], mPosition[2]);
				glRotatef(mYaw-90, 0.0f, 1.0f, 0.0f);
				//Start of Main Body
				glPushMatrix();
				glTranslatef(-1.25f, 0.0f, 0.35f);
				//glColor3f(0.592f, 0.984f, 0.596f);
				glBegin(GL_QUADS);

				// flat top of cow
				glColor3f(mColor[0], mColor[1], mColor[2]);
				glNormal3f(0.0f,1.0f,0.0f);
				glVertex3f(1.7f, 1.3f, -0.2f);
				glVertex3f(1.7f, 1.3f, -0.5f);
				glVertex3f(0.7f, 1.3f, -0.5f);
				glVertex3f(0.7f, 1.3f, -0.2f);

				//flat side1 panel1
				glColor3f(mColor[0], mColor[1], mColor[2]);
				glNormal3f(0.0f,0.0f,1.0f);
				glVertex3f(0.7f, 1.0f, 0.0f);
				glVertex3f(0.7f, 0.7f, 0.0f);
				glVertex3f(1.0f, 0.7f, 0.0f);
				glVertex3f(1.0f, 1.0f, 0.0f);
				
				//black spot side1 panel2
				glColor3fv(kColorBlack);
				glNormal3f(0.0f,0.0f,1.0f);
				glVertex3f(1.0f, 1.0f, 0.0f);
				glVertex3f(1.0f, 0.7f, 0.0f);
				glVertex3f(1.4f, 0.7f, 0.0f);
				glVertex3f(1.4f, 1.0f, 0.0f);
			    
				//flat side1 panel3
				glColor3f(mColor[0], mColor[1], mColor[2]);
				glNormal3f(0.0f,0.0f,1.0f);
				glVertex3f(1.4f, 1.0f, 0.0f);
				glVertex3f(1.4f, 0.7f, 0.0f);
				glVertex3f(1.7f, 0.7f, 0.0f);
				glVertex3f(1.7f, 1.0f, 0.0f);

				//flat side2
				glNormal3f(0.0f,0.0f,-1.0f);
				glVertex3f(1.7f, 1.0f, -0.7f);
				glVertex3f(1.7f, 0.7f, -0.7f);
				glVertex3f(0.7f, 0.7f, -0.7f);
				glVertex3f(0.7f, 1.0f, -0.7f);

				//diagonal top to side1
				glNormal3f(0.0f,0.5547f,0.83205f);
				glVertex3f(0.7f, 1.0f, 0.0f);
				glVertex3f(1.7f, 1.0f, 0.0f);
				glVertex3f(1.7f, 1.3f, -0.2f);
				glVertex3f(0.7f, 1.3f, -0.2f);

				//diagonal top to side1
				glNormal3f(0.0f,0.5547f,-0.83205f);
				glVertex3f(0.7f, 1.3f, -0.5f);
				glVertex3f(1.7f, 1.3f, -0.5f);
				glVertex3f(1.7f, 1.0f, -0.7f);
				glVertex3f(0.7f, 1.0f, -0.7f);
				
				// flat bottom of cow
				glNormal3f(0.0f,-1.0f,0.0f);
				glVertex3f(0.7f, 0.5f, -0.2f);
				glVertex3f(0.7f, 0.5f, -0.5f);
				glVertex3f(1.7f, 0.5f, -0.5f);
				glVertex3f(1.7f, 0.5f, -0.2f);

				//diagonal side1 to bottom
				glNormal3f(0.0f, -0.707107f, 0.707107f);
				glVertex3f(0.7f, 0.7f, 0.0f);
				glVertex3f(0.7f, 0.5f, -0.2f);
				glVertex3f(1.7f, 0.5f, -0.2f);
				glVertex3f(1.7f, 0.7f, 0.0f);

				//diagonal side2 to bottom
				glNormal3f(0.0f, -0.707107f, -0.707107f);
				glVertex3f(1.7f, 0.7f, -0.7f);
				glVertex3f(1.7f, 0.5f, -0.5f);
				glVertex3f(0.7f, 0.5f, -0.5f);
				glVertex3f(0.7f, 0.7f, -0.7f);

				//backside
				glNormal3f(1.0f, 0.0f, 0.0f);
				glVertex3f(2.0f, 1.0f, -0.5f);
				glVertex3f(2.0f, 1.0f, -0.2f);
				glVertex3f(2.0f, 0.7f, -0.2f);
				glVertex3f(2.0f, 0.7f, -0.5f);

				//top diagonal to arse
				glNormal3f(0.707107f, 0.707107f,0.0f);
				glVertex3f(1.7f, 1.3f, -0.5f);
				glVertex3f(1.7f, 1.3f, -0.2f);
				glVertex3f(2.0f, 1.0f, -0.2f);
				glVertex3f(2.0f, 1.0f, -0.5f);

				//bottom diagonal to arse
				glNormal3f(0.5547f, -0.83205f, 0.0f);
				glVertex3f(2.0f, 0.7f, -0.5f);
				glVertex3f(2.0f, 0.7f, -0.2f);
				glVertex3f(1.7f, 0.5f, -0.2f);
				glVertex3f(1.7f, 0.5f, -0.5f);

				//side1 diagonal to arse
				glNormal3f(-0.5547f, 0.0f, 0.83205f );
				glVertex3f(1.7f, 1.0f, 0.0f);
				glVertex3f(1.7f, 0.7f, 0.0f);
				glVertex3f(2.0f, 0.7f, -0.2f);
				glVertex3f(2.0f, 1.0f, -0.2f);

				//side2 diagonal to arse
				glNormal3f(0.5547f, 0.0f, -0.83205f );
				glVertex3f(1.7f, 1.0f, -0.7f);
				glVertex3f(2.0f, 1.0f, -0.5f);
				glVertex3f(2.0f, 0.7f, -0.5f);
				glVertex3f(1.7f, 0.7f, -0.7f);
				
				//frontglNormal3f();
				glNormal3f(-1.0f, 0.0f, 0.0f);
				glVertex3f(0.5f, 1.0f, -0.5f);
				glVertex3f(0.5f, 0.7f, -0.5f);
				glVertex3f(0.5f, 0.7f, -0.2f);
				glVertex3f(0.5f, 1.0f, -0.2f);

				//tail
				glColor3f(0.537f, 0.271f, 0.075f);
				glNormal3f(-1.0f, 0.0f,0.0f);
				glVertex3f(0.49f, 1.0f, -0.4f);
				glVertex3f(0.49f, 0.6f, -0.4f);
				glVertex3f(0.49f, 0.6f, -0.3f);
				glVertex3f(0.49f, 1.0f, -0.3f);
				
				//top diagonal to front
				glColor3f(mColor[0], mColor[1], mColor[2]);
				glNormal3f(-0.83205f, 0.5547f, 0.0f);
				glVertex3f(0.5f, 1.0f, -0.5f);
				glVertex3f(0.5f, 1.0f, -0.2f);
				glVertex3f(0.7f, 1.3f, -0.2f);
				glVertex3f(0.7f, 1.3f, -0.5f);
				
				//bottom diagonal to front
				glNormal3f(-0.707107f, -0.707107f, 0.0f);
				glVertex3f(0.7f, 0.5f, -0.5f);
				glVertex3f(0.7f, 0.5f, -0.2f);
				glVertex3f(0.5f, 0.7f, -0.2f);
				glVertex3f(0.5f, 0.7f, -0.5f);

				//side1 diagonal to front
				glNormal3f(-0.707107f, 0.0f, 0.707107f);
				glVertex3f(0.5f, 1.0f, -0.2f);
				glVertex3f(0.5f, 0.7f, -0.2f);
				glVertex3f(0.7f, 0.7f, 0.0f);
				glVertex3f(0.7f, 1.0f, 0.0f);

				//side2 diagonal to front
				glNormal3f(-0.707107f, 0.0f, -0.707107f);
				glVertex3f(0.7f, 1.0f, -0.7f);
				glVertex3f(0.7f, 0.7f, -0.7f);
				glVertex3f(0.5f, 0.7f, -0.5f);
				glVertex3f(0.5f, 1.0f, -0.5f);
				
				glEnd();

				glBegin(GL_TRIANGLES);

				//top rear triangle, side1
				glNormal3f(0.485071f, 0.485071f, 0.727607f );
				glVertex3f(1.7f, 1.3f, -0.2f);
				glVertex3f(1.7f, 1.0f, 0.0f);
				glVertex3f(2.0f, 1.0f, -0.2f);

				//top rear triangle, side2
				glNormal3f(0.485071f, 0.485071f, -0.727607f );
				glVertex3f(2.0f, 1.0f, -0.5f);
				glVertex3f(1.7f, 1.0f, -0.7f);
				glVertex3f(1.7f, 1.3f, -0.5f);

				//bottom rear triangle, side1
				glNormal3f(0.426401f, -0.639602f, 0.639602f);
				glVertex3f(1.7f, 0.7f, 0.0f);
				glVertex3f(1.7f, 0.5f,-0.2f);
				glVertex3f(2.0f, 0.7f, -0.2f);

				//bottom rear triangle, side2
				glNormal3f(0.426401f, -0.639602f, -0.639602f);
				glVertex3f(1.7f, 0.7f, -0.7f);
				glVertex3f(2.0f, 0.7f, -0.5f);
				glVertex3f(1.7f, 0.5f, -0.5f);

				//top front triangle, side1
				glNormal3f(-0.639602f, 0.426401f, 0.639602f );
				glVertex3f(0.7f, 1.3f, -0.2f);
				glVertex3f(0.5f, 1.0f, -0.2f);
				glVertex3f(0.7f, 1.0f, 0.0f);

				//top front triangle, side2
				glNormal3f(-0.639602f, 0.426401f, -0.639602f );
				glVertex3f(0.7f, 1.3f, -0.5f);
				glVertex3f(0.7f, 1.0f, -0.7f);
				glVertex3f(0.5f, 1.0f, -0.5f);

				//bottom front triangle, side1
				glNormal3f(-0.577350f, -0.577350f, 0.577350f );
				glVertex3f(0.7f, 0.7f, 0.0f);
				glVertex3f(0.5f, 0.7f, -0.2f);
				glVertex3f(0.7f, 0.5f, -0.2f);

				//bottom front triangle, side2
				glNormal3f(-0.577350f, -0.577350f, -0.577350f );
				glVertex3f(0.7f, 0.7f, -0.7f);
				glVertex3f(0.7f, 0.5f, -0.5f);
				glVertex3f(0.5f, 0.7f, -0.5f);

				glEnd();
				//End of Main Body

				//Legs start

				glBegin(GL_QUADS);
				//front leg on side 1
				//front leg side 1
				glNormal3f(0.0f,0.0f,1.0f);
				glVertex3f(0.7f, 0.7f, -0.1f);
				glVertex3f(0.7f, 0.0f, -0.1f);
				glVertex3f(0.8f, 0.0f, -0.1f);
				glVertex3f(0.8f, 0.7f, -0.1f);

				//front leg side 2
				glNormal3f(0.0f,0.0f,-1.0f);
				glVertex3f(0.8f, 0.7f, -0.2f);
				glVertex3f(0.8f, 0.0f, -0.2f);
				glVertex3f(0.7f, 0.0f, -0.2f);
				glVertex3f(0.7f, 0.7f, -0.2f);
				
				//front leg front
				glNormal3f(-1.0f,0.0f,0.0f);
				glVertex3f(0.7f, 0.7f, -0.2f);
				glVertex3f(0.7f, 0.0f, -0.2f);
				glVertex3f(0.7f, 0.0f, -0.1f);
				glVertex3f(0.7f, 0.7f, -0.1f);

				//front leg back
				glNormal3f(1.0f,0.0f,0.0f);
				glVertex3f(0.8f, 0.7f, -0.1f);
				glVertex3f(0.8f, 0.0f, -0.1f);
				glVertex3f(0.8f, 0.0f, -0.2f);
				glVertex3f(0.8f, 0.7f, -0.2f);
				
				//back leg on side 1
				//back leg side 1
				glNormal3f(0.0f,0.0f,1.0f);
				glVertex3f(1.6f, 0.7f, -0.1f);
				glVertex3f(1.6f, 0.0f, -0.1f);
				glVertex3f(1.7f, 0.0f, -0.1f);
				glVertex3f(1.7f, 0.7f, -0.1f);

				//back leg side 2
				glNormal3f(0.0f,0.0f,-1.0f);
				glVertex3f(1.7f, 0.7f, -0.2f);
				glVertex3f(1.7f, 0.0f, -0.2f);
				glVertex3f(1.6f, 0.0f, -0.2f);
				glVertex3f(1.6f, 0.7f, -0.2f);
				
				//back leg front
				glNormal3f(-1.0f,0.0f,0.0f);
				glVertex3f(1.6f, 0.7f, -0.2f);
				glVertex3f(1.6f, 0.0f, -0.2f);
				glVertex3f(1.6f, 0.0f, -0.1f);
				glVertex3f(1.6f, 0.7f, -0.1f);

				//back leg back
				glNormal3f(1.0f,0.0f,0.0f);
				glVertex3f(1.7f, 0.7f, -0.1f);
				glVertex3f(1.7f, 0.0f, -0.1f);
				glVertex3f(1.7f, 0.0f, -0.2f);
				glVertex3f(1.7f, 0.7f, -0.2f);
				
				//front leg on side 2
				//front leg side 1
				glNormal3f(0.0f,0.0f,1.0f);
				glVertex3f(0.7f, 0.7f, -0.5f);
				glVertex3f(0.7f, 0.0f, -0.5f);
				glVertex3f(0.8f, 0.0f, -0.5f);
				glVertex3f(0.8f, 0.7f, -0.5f);

				//front leg side 2
				glNormal3f(0.0f,0.0f,-1.0f);
				glVertex3f(0.8f, 0.7f, -0.6f);
				glVertex3f(0.8f, 0.0f, -0.6f);
				glVertex3f(0.7f, 0.0f, -0.6f);
				glVertex3f(0.7f, 0.7f, -0.6f);
				
				//front leg front
				glNormal3f(-1.0f,0.0f,0.0f);
				glVertex3f(0.7f, 0.7f, -0.6f);
				glVertex3f(0.7f, 0.0f, -0.6f);
				glVertex3f(0.7f, 0.0f, -0.5f);
				glVertex3f(0.7f, 0.7f, -0.5f);

				//front leg back
				glNormal3f(1.0f,0.0f,0.0f);
				glVertex3f(0.8f, 0.7f, -0.5f);
				glVertex3f(0.8f, 0.0f, -0.5f);
				glVertex3f(0.8f, 0.0f, -0.6f);
				glVertex3f(0.8f, 0.7f, -0.6f);
				
				//back leg on side 2
				//back leg side 1
				glNormal3f(0.0f,0.0f,1.0f);
				glVertex3f(1.6f, 0.7f, -0.5f);
				glVertex3f(1.6f, 0.0f, -0.5f);
				glVertex3f(1.7f, 0.0f, -0.5f);
				glVertex3f(1.7f, 0.7f, -0.5f);

				//back leg side 2
				glNormal3f(0.0f,0.0f,-1.0f);
				glVertex3f(1.7f, 0.7f, -0.6f);
				glVertex3f(1.7f, 0.0f, -0.6f);
				glVertex3f(1.6f, 0.0f, -0.6f);
				glVertex3f(1.6f, 0.7f, -0.6f);
				
				//back leg front
				glNormal3f(-1.0f,0.0f,0.0f);
				glVertex3f(1.6f, 0.7f, -0.6f);
				glVertex3f(1.6f, 0.0f, -0.6f);
				glVertex3f(1.6f, 0.0f, -0.5f);
				glVertex3f(1.6f, 0.7f, -0.5f);

				//back leg back
				glNormal3f(1.0f,0.0f,0.0f);
				glVertex3f(1.7f, 0.7f, -0.5f);
				glVertex3f(1.7f, 0.0f, -0.5f);
				glVertex3f(1.7f, 0.0f, -0.6f);
				glVertex3f(1.7f, 0.7f, -0.6f);

				glEnd();

				//End of Legs
				
				//HEAD start
				glBegin(GL_QUAD_STRIP);

				glNormal3f(0.0f,1.0f,0.0f);
				glVertex3f(2.2f, 1.1f, -0.4f);
				glVertex3f(2.0f, 1.1f, -0.4f);
				glVertex3f(2.2f, 1.1f, -0.3f);
				glVertex3f(2.0f, 1.1f, -0.3f);

				glNormal3f(0.0f,0.707107f, 0.707107f);
				glVertex3f(2.2f, 1.0f, -0.2f);
				glVertex3f(2.0f, 1.0f, -0.2f);

				glNormal3f(0.0f,0.0f,1.0f);
				glVertex3f(2.2f, 0.9f, -0.2f);
				glVertex3f(2.0f, 0.9f, -0.2f);

				glNormal3f(0.0f, -0.316228f, 0.948683f);
				glVertex3f(2.2f, 0.6f, -0.3f);
				glVertex3f(2.0f, 0.6f, -0.3f);

				glNormal3f(0.0f, -1.0f, 0.0f);
				glVertex3f(2.2f, 0.6f, -0.4f);
				glVertex3f(2.0f, 0.6f, -0.4f);

				glNormal3f(0.0f, -0.316228f, -0.948683f);
				glVertex3f(2.2f, 0.9f, -0.5f);
				glVertex3f(2.0f, 0.9f, -0.5f);
				
				glNormal3f(0.0f,0.0f,-1.0f);
				glVertex3f(2.2f, 1.0f, -0.5f);
				glVertex3f(2.0f, 1.0f, -0.5f);

				glNormal3f(0.0f,0.707107f, -0.707107f);
				glVertex3f(2.2f, 1.1f, -0.4f);
				glVertex3f(2.0f, 1.1f, -0.4f);

				glEnd();

				glBegin(GL_QUADS);

				//back of head top
				glNormal3f(-1.0f, 0.0f, 0.0f);
				glVertex3f(2.0f, 1.0f, -0.5f);
				glVertex3f(2.0f, 1.0f, -0.2f);
				glVertex3f(2.0f, 1.1f, -0.3f);
				glVertex3f(2.0f, 1.1f, -0.4f);
				
				//back of head bottom
				glNormal3f(-1.0f,0.0f,0.0f);
				glVertex3f(2.0f, 0.6f, -0.4f);
				glVertex3f(2.0f, 0.6f, -0.3f);
				glVertex3f(2.0f, 0.9f, -0.2f);
				glVertex3f(2.0f, 0.9f, -0.5f);

				//front of head top
				glNormal3f(1.0f,0.0f,0.0f);
				glVertex3f(2.2f, 1.1f, -0.4f);
				glVertex3f(2.2f, 1.1f, -0.3f);
				glVertex3f(2.2f, 1.0f, -0.2f);
				glVertex3f(2.2f, 1.0f, -0.5f);

				//front middle of head
				glNormal3f(1.0f,0.0f,0.0f);
				glVertex3f(2.2f, 1.0f, -0.5f);
				glVertex3f(2.2f, 1.0f, -0.2f);
				glVertex3f(2.2f, 0.9f, -0.2f);
				glVertex3f(2.2f, 0.9f, -0.5f);

				//front of head bottom
				glNormal3f(1.0f,0.0f,0.0f);
				glVertex3f(2.2f, 0.9f, -0.5f);
				glVertex3f(2.2f, 0.9f, -0.2f);
				glVertex3f(2.2f, 0.6f, -0.3f);
				glVertex3f(2.2f, 0.6f, -0.4f);

				glEnd();

				//eyes
				glColor3f(mColor[3], mColor[4], mColor[5]);
				glPushMatrix();
				glTranslatef (2.2f, 0.9f, -0.25f);
				glutSolidSphere(0.035 , 5, 5);
				glPopMatrix();

				glPushMatrix();
				glTranslatef (2.2f, 0.9f, -0.45f);
				glutSolidSphere(0.035 , 5, 5);
				glPopMatrix();

				//nose
				glPushMatrix();
				glTranslatef (2.2f, 0.65f, -0.33f);
				glutSolidSphere(0.035 , 5, 5);
				glPopMatrix();

				glPushMatrix();
				glTranslatef (2.2f, 0.65f, -0.37f);
				glutSolidSphere(0.035 , 5, 5);
				glPopMatrix();

				//End of Head
				glPopMatrix();
				}
				glPopMatrix();

				if(mFirst)
				{
					//Sets bounding boxes
					mHeadBounding.SetSphere(mPosition[0]+0.8f, mPosition[1]+0.85f, mPosition[2], 0.25f, kSphereHead);
					AddBody(mPosition[0]+0.2f, mPosition[1]+0.65f, mPosition[2], 0.65f);
					AddBody(mPosition[0]-0.1f, mPosition[1]+0.65f, mPosition[2], 0.65f);
					mMaster.SetSphere(mPosition[0], mPosition[1]+0.65f, mPosition[2], 1.1f, kSphereBody);
					mFirst=false;
				}
				else
				{
					//Updates bounding boxes
					UpdateCowHead(mYaw-90);
					UpdateCowBody(0.2f, mYaw, 0);
					UpdateCowBody(0.1f, mYaw, 1);
					mMaster.SetSphere(mPosition[0], mPosition[1]+0.65f, mPosition[2], 1.1f, kSphereBody);
				}

}

//Updates boss heads boundings
void cAnimateObject::UpdateBossHead(float dist, float yaw, int pos, float height)
{
	float x = cos(yaw*-1*kDegreesToRadians)*dist;
	float z = sin(yaw*-1*kDegreesToRadians)*dist;

	mBody[pos].SetSphere(mPosition[0]+x, height, mPosition[2]+z,0.65f, kSphereBody);
}

//UPdates cow body boundings
void cAnimateObject::UpdateCowBody(float dist, float yaw, int pos)
{
	float x = cos(yaw*-1*kDegreesToRadians)*dist;
	float z = sin(yaw*-1*kDegreesToRadians)*dist;

	mBody[pos].SetSphere(mPosition[0]+x, mPosition[1]+0.85f, mPosition[2]+z,0.65f, kSphereBody);
}

//Updates cow head bounding
void cAnimateObject::UpdateCowHead(float yaw)
{
	float x = cos(yaw*-1*kDegreesToRadians)*0.8f;
	float z = sin(yaw*-1*kDegreesToRadians)*0.8f;

	mHeadBounding.SetSphere(mPosition[0]+x, mPosition[1]+0.85f, mPosition[2]+z, 0.3f, kSphereHead);
}

//Gets vector of body boundings
std::vector<cBounding>* cAnimateObject::GetBoundingBody()
{
	return &mBody;
}

//Gets bounding head
cBounding* cAnimateObject::GetBoundingHead()
{
    return &mHeadBounding;
}

//Get master bouding sphere
cBounding* cAnimateObject::GetBoundingMaster()
{
    return &mMaster;
}

//Set direction of animate
void cAnimateObject::SetDirection(tVector3f d)
{
//	cout<<mType<<endl;
	mDirection[0]=d[0];
	mDirection[1]=d[1];
	mDirection[2]=d[2];
}

//Get direction X
float cAnimateObject::GetDirectionX()
{
	return mDirection[0];
}
//Get direction Y
float cAnimateObject::GetDirectionY()
{
	return mDirection[1];
}
//Get direction Z
float cAnimateObject::GetDirectionZ()
{
	return mDirection[2];
}

				
